* Prime Minister Thabane is safe, diplomats say
* Army units take over police buildings
* South Africa, SADC, expected to oppose any coup (Recasts, adds details, quote, background)
By Marafaele Mohloboli
MASERU, Aug 30 (Reuters) - Army soldiers in Lesotho occupied police buildings and surrounded the premier's residence in an apparent coup attempt on Saturday, but Prime Minister Thomas Thabane was safe, residents and diplomats said.
Gunfire was heard earlier in Maseru, capital of the small landlocked mountainous southern African kingdom where political tensions have been high since Thabane suspended parliament in June amid feuding in the two-year-old coalition government.
Residents and diplomats said that heavily-armed soldiers had surrounded State House and also occupied the main headquarters of the police force, which is loyal to Prime Minister Thabane.
The diplomats said that the army was mostly loyal to Deputy Prime Minister Mothetjoa Metsing, who had vowed to form a new coalition that would oust Thabane, who belongs to the All Basotho Convention party.
The army had made its move after the prime minister fired the army commander, the diplomatic sources said.
"The Prime Minister is definitely safe," one diplomat, who asked not to be named, told Reuters. At least one witness said police officers were being arrested by soldiers.
The streets of the capital were calm, residents said, although some shops remained closed.
South Africa, which completely surrounds Lesotho, and the regional Southern African Development Community (SADC) were expected to issue a stern call for calm and warn the Lesotho political rivals that no unconstitutional change of government would be tolerated.
The movements by the army also followed the police's banning of a march planned for Monday by Metsing's Lesotho Congress for Democracy party.
Since independence in 1966, Lesotho has undergone a number of military coups. In 1998 at least 58 locals and eight South African soldiers died and large 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 and Pascal Fletcher,; Writing by Pascal Fletcher; editing by Joe Brock and Tom Pfeiffer)