A gunman fired on the United States embassy in Bosnia on Friday in a 30-minute assault blamed by state television on a radical Islamist from neighbouring Serbia.

The gunman was wounded by a police sniper during the attack in Sarajevo's busy downtown, in which a police officer was seriously wounded and shop workers scrambled for cover.

Bosnian television identified the man, bearded and carrying a Kalashnikov assault rifle, as 23-year-old Mevlid Jasarevic, a Serbian citizen from the mainly Muslim town of Novi Pazar.

It said he had been visiting a community of hardline Islamists in northern Bosnia. A Reuters photograph of the gunman showed a tall man with a brown coat and a long beard.

Bosnia, which was torn apart by war between Bosniaks (Bosnian Muslim), Croats and Serbs in 1992-95 as Yugoslavia collapsed, is considered a strong ally of the United States in the turbulent Balkans.

Bakir Izetbegovic, the Muslim member of Bosnia's tripartite presidency, condemned the attack, saying the United States was a proven friend of Bosnia.

The American government and people have supported us in the most difficult moments of our history, and nobody has the right to endanger the friendly relations between our two countries, he said in a statement.

A police spokesman said the gunman had been taken to hospital for treatment but that his injuries were not life-threatening. A hospital spokeswoman said a man had been admitted under police escort with gunshot wounds to his upper leg.

The doctors are conducting a medical intervention and the man is expected to be escorted from hospital by the police in next two to three hours, said spokeswoman Biljana Jandric.

Embassy officials said the building had gone into lockdown during the assault, and no one in the embassy had been hurt.

Police spokesman Irfan Nefic said one police officer had been seriously wounded. He said police believed the gunman had acted alone, but that the investigation would reveal more.

The U.S. embassy in Sarajevo, a mainly Muslim city, closed briefly in March 2002 citing an unspecified threat, but the building has not come under attack before.

(Additional reporting by Daria Sito-Sucic, Maja Zuvela and Arshad Mohammed in Washington; Writing by Matt Robinson; Editing by Alistair Lyon)