Krakow, Poland (CNN) -- Poland's first couple was laid to rest on Sunday, marking the end of a journey filled with grief for the central European nation.
The bodies of President Lech Kaczynski and his wife were taken along the historic "royal route" from St. Mary's Basilica to Wawel Castle after the funeral Mass. Only guests invited by the family were permitted to attend the burial in the castle crypt.
Kaczynski's coffin was draped in the presidential flag, while his wife's was covered with the red-and-white Polish flag during the ceremony at the huge, elaborately decorated cathedral.
The ashen-faced twin brother of the late president led mourners at St. Mary's in this historic city at the funeral. Jaroslaw Kaczynski, dressed in a simple black suit and tie, was joined by Prime Minister Donald Tusk, former President Aleksander Kwasniewski, Lech Kaczynski's daughter and foreign dignitaries.
Tens of thousands of Poles dressed in black lined the streets and tossed flowers at the motorcade carrying the remains of the president and first lady, who were killed in a plane crash in Russia April 10.
Russia's President Dmitry Medvedev managed to make it to Krakow for the funeral despite air traffic restrictions across much of Europe due to a volcanic ash cloud from Iceland.
Medvedev bowed to pay his respects outside the cathedral as he arrived.
Krakow's Archbishop Stanislaw Dziwisz opened the Mass, saying he hoped the tragedy would strengthen ties between Russia and Poland.
Other world leaders including President Obama, French President Nicolas Sarkozy and German Chancellor Angela Merkel were forced to cancel plans to attend.
Cardinal Angelo Sodano, the head of the Vatican's College of Cardinals, had been scheduled to conduct the funeral Mass, but also had to cancel because of the volcano.
The Vatican's representative in Poland, Jozef Kowalczyk, read Sodano's homily.
About 50,000 mourners, some waving flags, sat in silence in Market Square outside the cathedral, where giant monitors televised the service, the Polish goverment press office said.
Some wept as soldiers gently carried the coffins into the church.
A 21-cannon salute and the tolling of the Sigismund Bell at Wawel Cathedral were part of the day's remembrance ceremonies.
Ninety-six people died in the April 10 crash, including dignitaries and top military leaders. The group was on its way to a service commemorating Polish prisoners of war massacred in Russia during World War II. The plane crashed in bad weather.
"Michelle and I continue to have the Polish people in our thoughts and prayers, and will support them in any way I can as they recover from this terrible tragedy," Obama said in a statement, expressing his regret at being unable to attend.
The ash also grounded British Foreign Secretary David Miliband and Prince Charles, the heir to the British throne.
The ash cloud drifting south and eastward over Europe poses a serious threat to aircraft. The volcano started erupting March 20 beneath the Eyjafjallajokull glacier in southern Iceland. It was still erupting and spewing ash Saturday and has forced local evacuations and affected European air space.
There were restrictions on civil flights across most of northern and central Europe.
"Quite frankly we can't blame people for not wanting to take even the smallest risk to the security of air traffic in the circumstances," said Radoslaw Sikorsky, Polish foreign minister.