Thailand's army has declared martial law "to keep law and order" after six months of violent unrest and anti-government demonstrations and one day after the country's caretaker prime minister refused to step down.

The move, which came as a surprise, was announced on the military's television channel and sparked fears that the move was part of a coup d'etat.

Thailand's army, which has staged 11 successful coups since the end of absolute monarchy in 1932, said in a statement that it had taken the action to "keep peace and order" and soldiers entered several private television stations that are sympathetic to protesters.

A ticker on Channel 5, an army station, however, denied the military was taking over, saying "the invocation of martial law is not a coup."

Violence in recent months mark the latest episode in eight years of upheaval that has pitted the largely rural supporters of populist former Prime Minister Thaksin Shinawatra against the Southeast Asian nation's traditional elites.

The crisis deepened the week before last when Thailand's constitutional court removed Yingluck Shinawatra from her position as prime minister for nepotism along with nine cabinet members in a case that many viewed as politically motivated. Protesters say Yingluck's removal is not enough. Niwattumrong Boonsongpaisan, who took over as caretaker prime minister, is from the same ruling party.

Three people were killed in explosions and a shooting attack against anti-government demonstrators last Wednesday as the country's electoral commission called for a July election rerun to be postponed. The deaths riased the nationwide toll since protests began last November to 27 dead and 800 wounded.

A senior US defence official told the Associated Press news agency last week that the US was "reasonably confident" that Thailand's military would not launch a coup, although analysts have warned the nation's political crisis could trigger armed conflict.

A spokesman for the army, Winthai Suvaree, also told Reuters last week: "The military is not planning to stage a coup and it will let politicians sort the country's problems out."

In 2006 the army sent tanks and troops into the capital to wrest power from the then prime minister, Thaksin Shinawatra, as he attended the United Nations general assembly in New York. It had been the army's first military intervention in 15 years.

Shinawatra fled Thailand in 2008 after being given a jail term and while a government of his allies was elected in the first post-coup polls it was later removed by the courts.

In 2010, his supporters occupied parts of Bangkok, where around 100 people died amid clashes and the following crackdown before the country entered a period of relative stability after his sister, Yingluck, came to power three years ago.