Thai soldiers patrol after army chief General Prayut Chan-O-Cha met with anti-government and pro-government leaders at the Army Club in Bangkok on May 22.Getty Images

BANGKOK — Thailand’s military seized power Thursday in a bloodless coup, dissolving the government, suspending the constitution and dispersing groups of protesters from both sides of the country’s political divide who had gathered in Bangkok and raised fears of a violent showdown.

The powerful army chief, Gen. Prayuth Chan-ocha, announced the military takeover in a statement broadcast on national television. It was followed by additional announcements including a nationwide curfew from 10 p.m. to 5 a.m. and an order for 18 government officials – including the ousted prime minister – to report immediately to the country’s new governing military commission.

There was no immediate sign of soldiers patrolling central Bangkok, but troops dispersed the two protest sites where competing groups were camped out – one backing the now-ousted elected government and one that had struggled for seven months to unseat it.

Although the military has insisted it wasn’t taking sides, its ousting of the elected government met the key goal of the anti-government protesters. The pro-government “Red Shirt” supporters had earlier said they would not tolerate a coup, but there were no immediate signs of resistance or reports of violence. The military provided hundreds of buses to take the protesters home.

Long lines formed at the city’s elevated train, subway stations and bus stations as panicked office workers tried to rush home before the curfew.

Flanked by the heads of the armed forces, Prayuth said the coup was launched “to quickly bring the situation back to normal, to let the people have love and unity as in the past, and to reform the political and economic systems – and to grant equality to every side.”

“We ask the public not to panic and carry on their lives normally,” Prayuth said, adding that the military would “provide protection” for foreigners in Thailand.

An army spokesman later announced that it had dissolved the caretaker government and suspended the constitution but that the Senate would remain in place. It also ordered the suspension of all television broadcasting and replaced programming with patriotic music to fill air time between announcements.

CNN, BBC and other cable news channels were also taken off the air.

The coup was the 12th since Thailand’s absolute monarchy ended in 1932.

“I hope the soldiers have come out this time to solve the problem once and for all. This is the fourth coup I’ve seen in my life now,” said Pinkaew Pipatada, 65, a flower vendor at the Erawan shrine, a popular tourist site in central Bangkok.

The pivotal developments came after Prayuth had declared martial law on Tuesday in what he called a bid to resolve the crisis, and a day later summoned the country’s rival political leaders for face-to-face talks. After two days of talks, the meeting failed to break the impasse.

Shortly before the announcement was made, armed soldiers in military vehicles surrounded the army facility where the politicians were meeting, apparently to block those inside from leaving.

Many of the country’s highest-profile figures were summoned for the meeting. They included the acting prime minister – who sent four Cabinet ministers in his place – and anti-government protest leader Suthep Thaugsuban, as well as Suthep’s rival from the pro-government Red Shirt group, Jatuporn Prompan. Suthep and Jatuporn were escorted out of the meeting by soldiers and detained.

A government official, Paradorn Pattanathabutr, contacted shortly after the announcement said the four ministers attending the meeting were still being held by the military.

“The rest of us who are outside are still fine and in the safe places. However, the situation is very worrying. We have to monitor it closely and don’t know what else can happen,” he said.

Thailand, an economic hub for Southeast Asia whose turquoise waters and idyllic beaches are a world tourist destination, 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 Thailand’s king.

His overthrow triggered a power struggle that in broad terms pits Thaksin’s supporters among a rural majority against a conservative establishment in Bangkok.

The latest round of unrest started in November, when demonstrators took to the streets to try to oust then-Prime Minister Yingluck Shinawatra, Thaksin’s sister. She dissolved the lower house of Parliament in December in a bid to ease the crisis, and later led a weakened caretaker government.

Since November, 28 people have been killed and hundreds injured, mostly in drive-by shootings and grenade attacks on protest sites.

Earlier this month, the Constitutional Court ousted Yingluck for abuse of power. But the move, which left the ruling party in charge, did little to resolve the conflict.

The army action followed threats by anti-government protesters to intensify their campaign to oust the ruling party, and an attack last week on protesters that killed three people and injured over 20.

Prayuth invoked the military’s expanded powers Tuesday and issued more than a dozen edicts that included broad powers of censorship over the media, the Internet and vaguely defined threats to prosecute opponents.

The military had insisted it was not seizing power, but said it was acting to prevent violence and restore stability in the deeply divided country. But he provided little clarity on a path forward, amid speculation both at home and abroad that the declaration of martial law was a prelude to a military coup.