Thousands flocked to the capital of Bosnia's Serb statelet on Saturday for the reopening of a historic mosque destroyed during wartime, a ceremony seen as encouraging religious tolerance among deeply divided communities.

Twenty years after the devastating war between its Muslim Bosniaks, Orthodox Serbs and Catholic Croats, Bosnia remains split along ethnic lines, with rival groups blocking reconciliation and reform needed to join the European Union.

The return of Muslim believers to the rebuilt Ferhat-Pasha mosque in the largely Serb city of Banja Luka, capital of Bosnia's autonomous Serb Republic, offers hope for change to many.

But tight security showed the ceremony, to be attended by top Bosnian officials and Turkey's outgoing Prime Minister Ahmet Davutoglu, was seen as a high-risk event. Turkey has contributed to the cost of rebuilding.

About 1,000 police officers patrolled the streets as buses arrived with Muslims from across the country. Traffic was barred from the city center and alcohol banned.

The 16th-century mosque, under Unesco protection as an outstanding example of Ottoman architecture, was blown up 23 years ago. A parking lot was built where it had stood.

Many believe its destruction was ordered by Bosnian Serbs aiming to erase any traces of Muslim heritage in the once multi-ethnic city.

During a ceremony to lay a foundation stone for the mosque in 2001, Serb nationalists attacked visitors and dignitaries, wounding dozens and killing one Muslim.

It took 15 years for Bosnia's Muslims to obtain construction permits and funds to rebuild the mosque. Thousands of pieces of rubble from the original building were used after being recovered from the Vrbas River and a garbage site where they were dumped.

The day it was leveled, May 7, is now the Day of the Mosques in Bosnia, where 614 mosques were destroyed during the 1992-95 war.

Today, only 10 percent of Banja Luka's pre-war Muslim and Croat population remains in the city following a Serb campaign to ethnically cleanse territories for their Serb statelet.

"I am excited," said Ajsa Nezirovic, 64, a Muslim from Banja Luka. "I know it will never be the same again but this may allow at least some people to feel welcome back to the city."

"I only want this opening to pass peacefully and without any incident as tensions still run high," said Tatjana Kecman, a Serb, also from Banja Luka.

"The mosque is rebuilt but our children have no jobs, and pensions are poor. We were all much better off before," said Fejhila, 58, a Muslim who stayed in Banja Luka during the war.

Efendi Husein Kavazovic, head of Bosnia's Islamic community, told local daily Nezavisne Novine on Friday the reopening could be a force for good, but added:

"We are still far away from honestly looking into each other's eyes and saying: 'We are sorry. We are truly sorry.'"

War casts a long shadow here, with Bosnian Serb leader Radovan Karadzic jailed for genocide only in March. The United Nations says Bosnian Serb backing for secession from the fragile Bosnian state is a challenge to the 1995 peace settlement.