The Thai army says that it is imposing martial law amid a political crisis "to preserve law and order".
The surprise announcement also granted the army wide-ranging powers to enforce its decision.
The military insisted that its assumption of responsibility for national security was not a coup.
Martial law comes after a long-running political crisis, and months of escalating tensions between the government and the opposition.
The chief security advisor to the interim prime minister said the government had not been consulted about the army's decision.
"Everything is normal except the military is responsible for all national security issues," said Paradorn Pattanatabut.
An army spokesman said that the imposition of martial law will have no impact on the caretaker government which remains in office.
The BBC's Jonathan Head in Bangkok says that the army's move - which it says is to stop "ill-intentioned groups from using war weapons" - has come as a surprise.
Our correspondent says that the army has made it clear that it is in charge of security and the site of troops on the streets is now likely to be much more commonplace.
Troops have taken steps to stop pro-government red-shirt supporters from gathering at their usual rallying-place outside Bangkok.
The Thai military last took power in 2006.
'No need to panic'
Earlier this month a court ordered Prime Minister Yingluck Shinawatra and several cabinet ministers to step down.
Soldiers have taken over television stations.
An announcement on military-run television said that martial law had been imposed "to restore peace and order for people from all sides".
"The public do not need to panic but can still live their lives as normal," the announcement said.
Thailand is mired in political mayhem, with the opposition demanding that power be handed over to an unelected administration charged with rewriting the constitution.
The military statement was signed by army chief Prayuth Chan-Ocha, citing a 1914 law that allows it to intervene during times of crisis.
It said that the move had been taken because mass rallies between political rivals "could impact the country's security and safety".
Censorship of the media has also been ordered by the army in the interests of "national security" and both pro and anti-government protesters have been ordered not to march anywhere in order to prevent clashes.
On Monday acting Prime Minister Niwatthamrong Boonsongphaisan insisted his government would not resign, resisting pressure from anti-government protesters.
Correspondents say that the deadlock in south-east Asia's second-largest economy has got worse since Yingluck dissolved the lower house of parliament in December and a court ordered her removal and the removal of nine cabinet ministers earlier in May for abuse of power.
The country has been without a properly functioning government since December and has failed to draw up a state budget.
The imposition of martial law could enrage supporters of the government, especially if it is seen as amounting to a coup, correspondents say.
The army has staged at least 11 coups since the end of the absolute monarchy in 1932.
Anti-government protests began in the Thai capital late last year, with demonstrators blockading several parts of the city.
In response, Yingluck called a snap general election in February that her party was widely expected to win. But the protesters disrupted the polls and the election was later annulled.
Yingluck's supporters believe that the courts are biased against her and side with the urban elite at the heart of the protest movement.
Thailand has faced a power struggle since Yingluck's brother, Thaksin Shinawatra, was ousted by the military as prime minister in the 2006 coup.