* Army units take over police buildings
* Prime Minister Thabane calls action "military coup"
* South Africa condemns actions of Lesotho army
* Army denies coup, says moved against rogue police elements (Adds U.S. reaction, paragraphs 16-18)
By Marafaele Mohloboli
MASERU, Aug 30 (Reuters) - Lesotho's prime minister, Thomas Thabane, on Saturday accused his country's army of staging a coup against him and fled to neighbouring South Africa, which condemned the military's action and called for a peaceful settlement.
Early morning gunfire was heard in Maseru, capital of the small southern African kingdom encircled by South Africa. Army units occupied police headquarters and surrounded the prime minister's residence, residents and diplomats said.
Hours after the army's move, the capital was reported to be quiet, but it was not immediately clear who was running the government of the mountainous state of 2 million people.
Thabane, who in June dissolved parliament to avoid a no-confidence vote against him amid feuding in his two-year-old coalition government, said he had crossed over to South Africa because he feared for his safety.
"There was clearly an effort to launch a coup," Thabane told Reuters, saying he was at his daughter's home in South Africa.
"We are taking concrete steps to nip it in the bud," he added, saying the regional Southern African Development Community (SADC) was addressing the situation.
South Africa, speaking on behalf of SADC, condemned the actions of the Lesotho military, which it said "bear the hallmarks of a coup d'etat". It called on Lesotho's army commander to order his units back to their barracks.
"Any unconstitutional change of government shall not be tolerated," South African Foreign Ministry spokesman Clayson Monyela told a news briefing in Pretoria.
Earlier, the Lesotho Defence Force denied attempting a coup against Thabane, saying it had moved against police elements suspected of planning to arm a political faction, an army spokesman said.
"There is nothing like that (a coup), the situation has returned to normalcy ... the military has returned to their barracks," Major Ntlele Ntoi told Reuters. He added the military "supports the democratically elected government of the day".
Ntoi said one soldier and four police had been injured during the army action. At least one witness reported police officers being detained by soldiers.
Diplomats in Maseru said the Lesotho army was mostly loyal to Deputy Prime Minister Mothetjoa Metsing, who had vowed to form a new coalition that would oust Thabane. The police force largely supported the prime minister, the sources said.
South Africa's Monyela said no individual or body had claimed to have taken over the government. "The situation is still unfolding," he said, adding that South Africa urged the coalition leaders to settle their differences peacefully.
The Commonwealth, most of whose member states are former British colonies, also condemned the reported coup.
"There is zero tolerance in the Commonwealth of any unconstitutional overthrow of an elected government," Commonwealth Secretary-General Kamalesh Sharma said in a statement sent to Reuters.
In Washington, the State Department issued a brief statement that condemned the violence but stopped short of calling it a coup or government overthrow.
"The United States is deeply concerned by clashes between security forces today in Lesotho, and calls upon government officials and all parties to remain committed to peaceful political dialogue and to follow democratic processes in line with the Lesotho Constitution and principles of the rule of law," it said.
Thabane said he had fired the Lesotho Defence Force commander, Lieutenant-General Kennedy Tlali Kamoli, replacing him with Brigadier Maaparankoe Mahao. But the army spokesman told Reuters Kamoli was still in charge of the military.
Thabane said: "Commanders of armies are appointed by government, it is not up to them to say who is in control."
He said he intended to return home, but did not specify when. "That is something I will have to weigh," he said.
Since independence from Britain in 1966, Lesotho has undergone a number of military coups. In 1998 at least 58 locals and eight South African soldiers died and parts of Maseru were damaged during a political stand-off and subsequent fighting.
Besides textile exports and a slice of regional customs receipts, Lesotho's other big earner is hydropower exported to South Africa from the massive mountain ranges that have made it a favourite of trivia fans as "the world's highest country" - its lowest point is 1,380 metres (4,528 feet) above sea level. (Additional reporting by Peroshni Govender, Joe Brock, Helen Nyambura, Pascal Fletcher, and Sandra Maler in Washington; Writing by Pascal Fletcher; Editing by Joe Brock and Leslie Adler)
Our Standards: The Thomson Reuters Trust Principles.