BANGKOK - Thailand's army declared martial law before dawn Tuesday in a surprise announcement it said was aimed at keeping the country stable after six months of sometimes violent political unrest. The military, however, denied a coup d'etat was underway.

The move effectively places the army in charge of public security nationwide. It comes one day after the Southeast Asian country's caretaker prime minister refused to step down and follows six months of anti-government demonstrations that have failed to oust the government.

Armed troops entered multiple private television stations in Bangkok to broadcast their message and surrounded the national police headquarters in the city center. But the vast skyscraper-strewn metropolis of 10 million people appeared calm, and commuters could be seen driving and walking to work as usual.

On a major road in front of Central World, one of the country's most luxurious shopping malls, bystanders gawked at soldiers in jeeps mounted with a machine-guns diverted traffic. The mood wasn't tense; passers-by stopped to take cell phone photos of the soldiers.

An army official, speaking on condition of anonymity because of the sensitivity of the situation, told The Associated Press "this is definitely not a coup. This is only to provide safety to the people and the people can still carry on their lives as normal."

Justice Minister Chaikasem Nitisiri told the AP the army had not consulted the Cabinet, but he played down the move, saying the army was "only taking over security" and it would not affect the Cabinet.

Reacting to the army's move, U.S. State Department spokesperson Jen Psaki said in a statement that the Obama administration was "very concerned about the deepening political crisis in Thailand and urge all parties to respect democratic principles, including respect for freedom of speech."

"We expect the Army to honor its commitment to make this a temporary action to prevent violence, and to not undermine democratic institutions," said Psaki, urging Thailand to hold elections to pick a new government quickly.

Thailand's army has staged 11 coups since the end of absolute monarchy in 1932.

Thailand, an economic hub for Southeast Asia, has been gripped by off-and-on political turmoil since 2006, when former Prime Minister Thaksin Shinawatra was toppled by a military coup after being accused of corruption, abuse of power and disrespect for King Bhumibol Adulyadej.

The latest round of unrest started last November, when anti-government protesters took to the streets to try to oust then-Prime Minister Yingluck Shinawatra, Thaksin's sister. She had dissolved the lower house of parliament in December in a bid to ease the crisis.

Earlier this month, the Constitutional Court ousted Yingluck and nine Cabinet ministers earlier this month for abuse of power, but the move has done little to resolve the political conflict that largely pits the rural poor majority who support Yingluck and her opponents that largely come from the urban middle and upper class.

The military statement was signed by army chief Gen. Prayuth Chan-Ocha, who later read it on air and asked people not to panic.

He cited a 1914 law that gives the authority to intervene during times of crisis, and said it had taken the action because on-going mass rallies between political rivals "could impact the country's security and safety of the lives and public property."

The leader of the pro-government Red Shirt movement, Jatuporn Prompan, said his group could accept the imposition of martial law, but said they "won't tolerate a coup or other non-constitutional means" to grab power.

"We will see what the army wants," he said, warning that the undemocratic removal the country's caretaker government "will never solve the country's crisis and will plunge Thailand deeper into trouble."

Red Shirts had been massing for days on the outskirts of Bangkok, and Jutaporn said his supporters were being "surrounded." More than 100 soldiers deployed near the rally venue with coils of barbed wire to block roads; they appeared to be taking over control of the area from police.

On Monday, Thailand's acting prime minister insisted his government will not resign, resisting pressure from a group of senators who are seeking ways to settle the country's political crisis, and from anti-government protesters who are demanding an appointed prime minister.

A group of about 70 senators, most of whom are seen as siding with the anti-government protesters, proposed a framework on Friday that calls for a government with full power to conduct political reforms.

Acting Prime Minister Niwattumrong Boonsongpaisan and Justice Minister Chaikasem Nitisiri met with two representatives of the Senate in an undisclosed location Monday to avoid disruption from the protesters.

After the meeting, Niwattumrong said the Cabinet cannot resign because it would be unconstitutional to do so. He insisted he "can carry out duties and has full authority" as prime minister.

The Cabinet has operated in a caretaker capacity with limited power since Yingluck dissolved the lower house in December in a failed bid to ease the political crisis. A new government cannot normally be named until there are elections, which anti-government demonstrators have vowed to block unless political reforms occur first.

The Senate, the only functioning legislative body in the country, was seen as the last resort of the anti-government protesters, who are calling for an interim, unelected prime minister to be chosen.

The protesters say they are making their final push to oust the government and install an unelected prime minister and government. They have promised to call off their rallies if they are not successful by May 26, following six months of street demonstrations in which 28 people have died and hundreds of others have been injured.

The protesters on Monday began searching for members of the Cabinet at their residences to pressure them to resign, but did not find any.

Labor unions representing about 20 state-owned enterprises vowed to go on strike Thursday to support the anti-government protesters, although several companies, including Thai Airways and the Electricity Generating Authority of Thailand, said Monday that they would operate normally.

Thaksin, a former telecommunications billionaire, remains highly popular among the poor in the north and northeast, and parties controlled by him have won every national election since 2001. The anti-government protesters, who are aligned with the opposition Democrat Party and backed by the country's traditional elites, say they want to remove all traces of his political machine from politics.

Thaksin's supporters have staged a rally in Bangkok's western outskirts since May 10, raising concerns about possible clashes between them and the anti-government protesters.