By VICTOR L. SIMPSON
Associated Press Writer
VATICAN CITY - Presidents, prime ministers and kings joined pilgrims and prelates in St. Peter's Square today to bid an emotional farewell to Pope John Paul II at a funeral service that drew millions to Rome for the largest gathering of the powerful and the humble in modern times.
Applause rang out in the wind-whipped square as John Paul's plain cypress coffin, adorned with a cross and an ''M'' for the Virgin Mary, was brought out from St. Peter's Basilica and placed on a carpet in front of the altar. The book of the Gospel was placed on the coffin and the wind lifted the pages.
After the Mass ended, bells tolled and 12 pallbearers with white gloves, white ties and tails presented the coffin to the crowd one last time, and then carried it on their shoulders back inside the basilica for burial - again to sustained applause from the hundreds of thousands in the square, including dignitaries from 138 countries.
Chants of ''Santo! Santo!'' - urging John Paul to be elevated to sainthood immediately - echoed in the square.
The first non-Italian pope in 455 years was buried at 2:20 p.m. (8:20 a.m. EDT) in the grotto under the basilica, attended by prelates and members of the papal household, the Vatican said.
The 2-hour Mass began with the Vatican's Sistine Choir singing the Gregorian chant, ''Grant Him Eternal Rest, O Lord.'' Cardinals wearing white miters walked onto the square, their red vestments blowing in the breeze.
Cardinal Joseph Ratzinger, dean of the College of Cardinals, a close confidant of John Paul and a possible successor, presided at the Mass and referred to him as our ''late beloved pope'' in a homily that traced the pontiff's life from his days as a factory worker in Nazi-occupied Poland to his final days as the head of the world's 1 billion Catholics.
Interrupted by applause at least 10 times, the usually unflappable German-born Ratzinger choked up as he recalled one of John Paul's last public appearances.
''We can be sure that our beloved pope is standing today at the window of the father's house, that he sees us and blesses us,'' he said to applause, even among the prelates, as he pointed up to the third-floor window above the square.
''Today we bury his remains in the earth as a seed of immortality - our hearts are full of sadness, yet at the same time of joyful hope and profound gratitude,'' Ratzinger said in heavily accented Italian.
He said John Paul was a ''priest to the last'' and said he had offered his life for God and his flock ''especially amid the sufferings of his final months.''
Ratzinger was interrupted again toward the end of the Mass by several minutes of cheers, rhythmic applause and shouts of ''Giovanni Paolo Santo'' or ''Saint John Paul,'' from the crowd. The eruption of cheers came right before the Litany of Saints chant, in which the names of the saints are read.
The Mass ended with everyone standing and singing together: ''May the angels accompany you into heaven, may the martyrs welcome you when you arrive, and lead you to Holy Jerusalem.''
John Paul requested in his last will and testament to be interred ''in the bare earth,'' and he was laid to rest among the pontiffs from centuries past near the tomb traditionally believed to be of the apostle Peter, the first pope.
The coffin was definitively closed with red bands and both papal and Vatican seals, and nested inside a second casket of zinc and then within a third of walnut. The outside casket bears the name of the pope, his cross and his papal coat of arms.
The casket was then lowered into the ground in a plot inside a small chapel, between the tombs of two women: Queen Christina of Sweden and Queen Carlotta of Cyprus, said a senior Vatican official who attended the ceremony.
Closed to the public, the service was witnessed by top Vatican prelates and performed by the camerlengo, or chamberlain, Cardinal Eduardo Martinez Somalo. He concluded with the words: ''Lord, grant him eternal rest, and may perpetual light shine upon him.''
John Paul's tomb will be covered with a flat stone bearing his name and the dates of his birth and death.
Papal spokesman Joaquin Navarro-Valls said the Vatican would announce in a few days when the grotto would be reopened to the public.
At least 300,000 people filled St. Peter's Square and spilled out onto the wide Via della Conciliazione leading toward the Tiber River, but millions of others watched on giant video screens set up across Rome. Banners read ''Santo Subito,'' or ''Sainthood Immediately.''
Many had camped out on the cobblestones in their sleeping bags, with hordes of the faithful stepping over them as they tried to secure a good spot to view the Mass.
The square and the boulevard leading to it were a sea of red and white flags waved by pilgrims from John Paul's native Poland, many in traditional dress shouting ''Polska! Polska!'' Pilgrims from other countries raised their national flags in the crowd and prayers were read out during the Mass in a host of languages.