The Thai government declared a state of emergency banning gatherings of more than four people and outlawing online posts deemed a threat to national security on Thursday in a move to end simmering pro-democracy protests.

The order was aimed at stamping out the "unconstitutional" protests and came after demonstrators demanding the prime minister's resignation rallied outside his office in Bangkok overnight and scuffled with royalists opposed to the youth-led movement's calls for reforms to the monarchy.

Pro-democracy activists have staged nationwide rallies since July, demanding reform in Thailand
Pro-democracy activists have staged nationwide rallies since July, demanding reform in Thailand AFP / Lillian SUWANRUMPHA

Student activists have staged huge demonstrations since July calling for Premier Prayut Chan-o-cha, a former army chief who took power in a coup six years ago, to step down.

The state of emergency allows for the seizure of "electronic communications equipment, data, and weapons suspected to cause the emergency situation", a government spokesman said.

IMAGESMore than a thousand protesters mass early for a pro-democracy rally, as tensions rise in Bangkok the day after police arrested 21 activists part of a movement calling for an overhaul to the government and reforms to the monarchy.
IMAGESMore than a thousand protesters mass early for a pro-democracy rally, as tensions rise in Bangkok the day after police arrested 21 activists part of a movement calling for an overhaul to the government and reforms to the monarchy. AFPTV / Jonathan KLEIN

It was unclear if a protest scheduled for later Thursday at a major Bangkok intersection would go ahead, with police warning that demonstrators "can no longer gather... as planned or they will face arrest".

Tensions flared on Wednesday as thousands of demonstrators rallied around Democracy Monument in Bangkok ahead of a scheduled afternoon drive-by of a royal motorcade carrying King Maha Vajiralongkorn and his family.

While police had cordoned off most of the protesters away from the royal route, dozens were still present as the motorcade passed.

Thailand's pro-democracy protesters are calling for an overhaul of the government and the resignation of Premier Prayut Chan-O-Cha
Thailand's pro-democracy protesters are calling for an overhaul of the government and the resignation of Premier Prayut Chan-O-Cha AFP / Lillian SUWANRUMPHA

Queen Suthida could be seen staring from a limousine window as protesters held up three-fingered salutes -- a gesture of defiance the pro-democracy movement has borrowed from the popular "Hunger Games" books and films.

Such overt challenges to the monarchy are unprecedented in Thailand, where the royal family's influence permeates every aspect of society.

Gathered along the motorcade route were thousands of others dressed in yellow shirts -- the king's colours -- who said they were hoping to catch a glimpse of the monarch later
Gathered along the motorcade route were thousands of others dressed in yellow shirts -- the king's colours -- who said they were hoping to catch a glimpse of the monarch later AFP / Mladen ANTONOV

Those calls have prompted a backlash from Thailand's staunchly pro-royalist establishment.

The King is the most powerful figure in Thailand and is supported by the kingdom's powerful military and billionaire clans.

He spends much of his time in Europe, but he and his family have been in Thailand in recent days for an annual Buddhist merit-making ceremony.

More than 15,000 police were deployed to control the situation
More than 15,000 police were deployed to control the situation AFP / Lillian SUWANRUMPHA

Wednesday's drive-by was the first encounter the royal family has had with the protesters.

IMAGESMore than a thousand protesters mass early for a pro-democracy rally, as tensions rise in Bangkok the day after police arrested 21 activists part of a movement calling for an overhaul to the government and reforms to the monarchy.
IMAGESMore than a thousand protesters mass early for a pro-democracy rally, as tensions rise in Bangkok the day after police arrested 21 activists part of a movement calling for an overhaul to the government and reforms to the monarchy. AFPTV / Jonathan KLEIN

Several popular anti-government movements have arisen in the turbulent modern history of Thailand, which has endured long bouts of political unrest and more than a dozen successful military coups since 1932.

The army has long positioned itself as the sole defender of the ultra-wealthy king, whose power stretches across every facet of Thai society.

Activists have repeatedly said they wish only for the monarchy to adapt to modern times.

Their demands include the abolition of a strict royal defamation law -- which shields the king from criticism -- and for the monarch to stay out of politics.

Since the protests started, dozens of activists have been arrested, charged with sedition and released on bail.

Government spokesman Anucha Burapachaisri said the premier had ordered police to press charges against "the protesters who obstructed the royal motorcade" on Wednesday.

Charges will also be pursued against "those who had acted in a way that defames the monarchy," he said in a statement.

"They must face legal procedures without exception."

After protesters marched to the Government House, they stayed through the night shouting for Prayut to "get out", while some camped outside.

Organiser Tattep Ruangprapaikitseree reiterated the need for a rewrite of a 2017 military-scripted constitution.

"The new constitution must bring Thailand to a democratic system with the monarchy institution truly governed under it," he said.

"This could be the last fight for Thailand's democracy," said 18-year-old Attaporn, who travelled from the kingdom's northern Pichit province to join the rally.

"I have to do this if I want a better future."