By Sayed Sarwar Amani

KANDAHAR, Afghanistan (Reuters) - Hundreds in southern Afghanistan rallied to praise the killing of 12 people at the French newspaper Charlie Hebdo, calling the two gunmen "heroes" who meted out punishment for cartoons disrespectful to Islam's prophet, officials said Saturday.

The demonstrators also protested President Ashraf Ghani's swift condemnation of the bloody attack on the satirical newspaper, according to the officials in Uruzgan province.

The rally came after worshippers left Friday prayers at a local mosque in Chora district and swelled to several hundred people, said Chora police chief Abdul Qawi.

"The protesters were calling the attackers heroes and were shouting that those who had mocked the Prophet Mohammad were punished," Qawi said.

Provincial police chief Matiullah Khan said that police had been informed in advance of the demonstration, which was allowed under the Afghan constitution's free-speech provisions.

"They provided good security and it was peaceful," he said.

Afghan President Ghani issued a condemnation the day after the newspaper attack saying "there is no justification for this brutal act".

The two brothers wanted for gunning down 12 people at the Charlie Hebdo office in Paris were killed on Friday when French anti-terrorist police stormed their hideout.

Afghanistan remains a deeply conservative Muslim society, more than 13 years after the Taliban's hardline Islamist regime was toppled by U.S.-backed forces for sheltering al Qaeda leaders suspected of planning the Sept. 11, 2001 attacks on the United States.

Previous insults to Islam have sparked protests that turned violent.

Seven U.N. workers were killed during protests that raged across Afghanistan for three days in April 2011 after a U.S. pastor burned a Koran in Florida.

However, this week many Afghans reacted in horror and dismay after the Paris newspaper attack, saying the insult to Islam did not justify bloodshed.

"Out of solidarity with the people of France, we strongly condemn this barbaric attack on #CharlieHebdo," read one Afghan posting on Twitter.

"Terrorism has no race, religion or country. Terrorism is everyone's enemy," another tweet said.

(Additional reporting by Hamid Shalizi. Writing by Kay Johnson, editing by Rosalind Russell)