More than 25,000 people marched in defence of secularism in mainly Muslim Turkey yesterday, shocked after the killing of a leading judge by a gunman said to be driven by religious fervour.

Angry crowds outside the Ankara mosque where the funeral of slain judge Mustafa Ozbilgin was being held pushed government ministers on their way inside, and outside the country's top administrative court bystanders booed the foreign minister, Abdullah Gul, and called for the government's resignation.

Four more people were detained in connection with the killing on Wednesday, when a lawyer stormed into a chamber of the top court, shooting Mr Ozbilgin dead and injuring four others while shouting that he was a soldier of Allah.

The attack raised tensions between the secular establishment and the religious-minded government and sparked an outpouring of nationalist sentiment across the Turkish capital.

Judges led thousands of people to Mustafa Kemal Ataturk's mausoleum to pay homage to the republic's founder and mark their support for secularism. Thousands also walked behind the judge's coffin to the Ankara mosque, where prayers were read.

"Murderers get out," dozens of people shouted as security forces tried to clear the way for several government ministers, including the deputy prime minister, Abdullatif Sener, to enter the mosque as they were pushed by the angry crowd. The secularist president, Ahmet Necdet Sezer, was applauded on arrival at the mosque. Turkey's prime minister, Tayyip Erdogan, is attending a conference in the tourist city of Antalya.

The top administrative court, or council of state, has come under intense criticism from Islamists for its strict upholding of Turkey's secular laws, especially the ban on wearing headscarves in universities and public offices. "We will not be intimidated," said the council of state president, Sumru Cortoglu, after the march to the Ataturk mausoleum.

The gunman, who was detained after the attack, targeted judges because in February they ruled against a woman who wore a headscarf becoming a headteacher, said the council's deputy chairwoman.

Police declined to comment on reports of further detentions.

"We have to rally against the people who brought our country to this point. We're so sorry about this attack and therefore we all want to be on the streets and make our voices heard," Gumus Ocak, a woman in Ankara, told Reuters.

Turkey's political leaders, including Mr Erdogan, have condemned the attack.

Mr Erdogan and his ruling Justice and Development party, which has roots in political Islam, had strongly criticised the judge's ruling. The prime minister's wife wears a headscarf. The ban began in the 1980s but dates back to Ataturk, who abolished religious dress and adopted a Swiss-style legal code in 1926.