* Army says declares martial law to restore stability
* Says not interfering with caretaker government
* To avoid clashes, orders protesters on both sides not to march
* TV stations run by rival political groups ordered to shut down
* U.S. says monitoring situation closely (Updates with comment from protest leader)
By Amy Sawitta Lefevre
BANGKOK, May 20 (Reuters) - Thailand's army declared martial law nationwide on Tuesday to restore order after six months of street protests that have left the country without a proper functioning government, but insisted the surprise intervention was not a military coup.
While troops patrolled parts of Bangkok and army spokesmen took to the airwaves, the caretaker government led by supporters of self-exiled former premier Thaksin Shinawatra said it was still running the country.
Army chief General Prayuth Chan-ocha said the military had stepped in to restore order and build investor confidence, and warned that troops would take action against anyone who used weapons and harmed civilians.
"We ask all sides to come and talk to find a way out for the country," Prayuth told reporters after meeting directors of government agencies and other high-ranking officials.
Military officials said they were not interfering with the caretaker government, but ministers were not informed of the army's plan before an announcement on television at 3 a.m. (2000 GMT on Monday) and Prayuth said martial law would be maintained until peace and order had been restored.
Twenty-eight people have been killed and 700 injured since the anti-government protests began in November last year.
The crisis is the latest chapter in a near-decade-long power struggle between former telecoms tycoon Thaksin and the royalist establishment that has brought the country to the brink of recession and even raised fears of civil war.
Troops, some in jeeps mounted with machineguns, stopped some traffic from entering Bangkok after the martial law order. They also took up position at intersections and secured television stations, but life went on as normal in most of the city.
Both pro- and anti-government protesters are camped out at different places in the capital and, to prevent clashes, the army told them they had to stay put.
The army also ordered 10 satellite TV channels, both pro- and anti-government, to stop broadcasting.
The caretaker government, wary of the army given its past interventions on the side of the establishment, said it welcomed the move to restore order and that it remained in office.
Thailand has been stuck in political limbo since Prime Minister Yingluck Shinawatra, Thaksin's younger sister, and nine of her ministers were dismissed on May 7 after a court found them guilty of abuse of power.
The military, which put down a pro-Thaksin protest movement in 2010, has staged numerous coups since Thailand became a constitutional monarchy in 1932. The last one was in 2006 to oust Thaksin, who has lived abroad since 2008 but wields political influence and commands huge support among the poor.
Anti-government protesters want a "neutral" prime minister to oversee electoral reforms aimed at ending Thaksin's influence. They disrupted a Feb. 2 election that Thaksin's loyalists looked set to win. It was later declared void.
The government, on the other hand, views an early general election it would likely win as the best way forward.
Both sides said they were sticking to their demands.
"Martial law does not affect our civil uprising," Suthep Thaugsuban, the leader of the anti-government protesters, told his cheering supporters. "We still retain our right to demonstrate against this tyrannical government."
Earlier, caretaker Prime Minister Niwatthamrong Boonsongphaisan said he had asked the Election Commission to set the ballot for Aug. 3 and he was in talks with the army.
"We are talking to the army chief's side and there are many pressing issues we need to discuss including elections and reform," Niwatthamrong told reporters.
The army tried to mediate in the crisis late last year, bringing together then-premier Yingluck and anti-government protest leader Suthep. It had played down fears of a coup, stressing that politicians must resolve the dispute.
But Human Rights Watch called martial law a "de facto coup" while a political analyst said it was a "phantom coup".
"For this to be a success the army needs to act like a neutral force and not be seen to side with the anti-government protesters. It needs to offer an election date and start a political reform process," said Kan Yuenyong at the Siam Intelligence Unit think-tank.
Martial law gives the military broad powers over civilian authorities, but a full coup would likely incur costs in terms of greater damage to investor confidence and U.S. sanctions.
The United States, which cut aid to its military ally after the 2006 coup, said it was monitoring the situation closely.
Prayuth had warned last week, after three people were killed in an attack on anti-government protesters, that troops might have to be used if violence continued.
"He now feels that the police cannot handle security and is alarmed by grenade attacks and other incidents and the fact neither side looks like it will back down," said a senior army official, who spoke on condition of anonymity.
"NO COUP YET"
The baht fell against the dollar in early trade but steadied later and dealers suspected that was due to intervention by the central bank. At 0900 GMT the baht was quoted at 32.53 per dollar after earlier trading at a low of around 32.64.
The stock market ended 1.13 percent down.
Six months of turmoil has dragged down Southeast Asia's second-biggest economy, which shrank 2.1 percent in the first quarter of the year.
Andrew Colquhoun, Head of Asia-Pacific Sovereigns at ratings agency Fitch, said martial law was not necessarily negative for Thailand's government debt, and might help break the deadlock.
"The key factors for the ratings are whether Thailand can avert more serious and bloody political disorder, and whether we see a return to a fully functioning government that is able to make policy and pass a budget for the next fiscal year."
The leader of Thaksin's pro-government "red shirt" loyalists, who are rallying in Bangkok's outskirts, appealed for calm but warned of trouble if the government was ousted.
"If soldiers appoint a prime minister then we will escalate our rally," Jatuporn Prompan told a news conference. "Stay calm. There has been no coup yet." (Additional reporting by Bangkok Bureau; Writing by Robert Birsel; Editing by Alan Raybould, Alex Richardson and Mike Collett-White)