Television pictures showed injured people being carried away to ambulances from the court, the Council of State, which is in the heart of Ankara.

Police imposed tight security around the building after the attack on Wednesday.

A court official had earlier said one judge died in the attack, but later said the judge was wounded. One judge was in a critical condition with head injuries.   

"We condemn this attack with disgust, whoever is behind it. The investigation is continuing and the attacker has been detained," justice minister Cemil Cicek told reporters outside the court.   

The CNN Turk web site said the attack occurred in the court's second chamber during a committee meeting. The chamber's chairman Mustafa Birden was among the injured.   

The wounded were being treated in hospital.   

Attacker detained

Police have detained the gunman and were questioning him at the local police headquarters. The motive for the attack was not known, but the web site said the attacker, wielding a handgun, was believed to be a lawyer.   

Private news channel NTV reported eyewitnesses as saying the gunman had shouted "Allahu akbar" (God is greatest) and "may God's wrath be upon you" as he carried out the attack.   

The court's second chamber deals with education issues and has been the target of criticism from Islamist circles due to its hardline secularist implementation of an official ban on wearing headscarves in official places.   

Islamic militants, Kurdish separatists and far-leftists have all carried out armed attacks in Turkey in recent years.