Bangkok, Thailand — By day, they listen to protest speeches, shake their rattles, and line up for free meals. By night, they bed down in the doorways of ornate buildings inside a walled government compound, guarded by their own militia against possible police attack.

A week after occupying the seat of civilian power here, thousands of Thai antigovernment protestors are digging in for the long haul. Prime Minister Samak Sundaravej – the main target of their sit-in – refuses to resign. A court last week ordered the arrest of nine protest leaders, but their lawyers are appealing. Authorities withdrew an eviction notice for protesters after clashes Friday with police, who were forced to retreat.

As pro-government supporters gather in smaller numbers in a nearby park, fears of violent confrontation are growing, underscoring deep social and political divisions. At stake are Thailand's shaky democracy and the future role of elites aligned with the monarchy and the military, whose dominance has been upended by decades of rapid social change.

In 2006, similar street protests against then-Prime Minister Thaksin Shinawatra, paralyzed the nation and led to a military coup that did little to heal these divisions. Mr. Thaksin and his wife recently sought exile in Britain after losing the first of several court cases filed over alleged abuses of power during his five years in office.

In an emergency session on Sunday, Mr. Samak berated his opponents in parliament for siding with protestors who had broken the law. He rejected a motion to dissolve parliament as a way out of the crisis.

"I want to show the world that democracy in Thailand was built to last," he said.

But railway services are still being disrupted by walkouts. The People's Alliance for Democracy (PAD), the group that seized the prime minister's compound, has threatened to escalate such actions if their demands aren't met.

Among these royalist opponents of Samak, there is anger at the return to power of old political faces. They accuse Samak of corruption at the behest of Thaksin, his political patron, and of surrendering territory to Cambodia in a border temple dispute. Some call for an overhaul of a political system that gives too much weight to the poor, Thaksin's loyal constituency.

Leaders of the PAD are hostile to Western-style democracy, arguing that it has failed to produce suitable leaders and instead encouraged vote-buying and corruption. In its place, they propose a partially elected legislature and a backstop role for the military to keep politicians in line.

"It's a failure of political parties. Not a failure of democracy," says Kasit Piromya, a former Thai diplomat and an opposition supporter.

This criticism reflects both the frustration borne out of Thaksin's electoral success – repeated last December by Samak – and a conservative backlash against globalization. The PAD was formed in 2006 after Thaksin sold his family-owned telecommunications company to Singapore's government, igniting nationalist anger. A military-installed government later sought unsuccessfully to restrict foreign ownership in Thailand.

In 2006, tens of thousands of Bangkok residents wore royalist yellow at all-night PAD rallies. Far fewer have joined the current protests, though, while some former allies have condemned the vandalism of state property and use of weapons as extremist.

Police last week seized stacks of golf clubs and sticks from the PAD. Middle-class Thais who marched against Thaksin are weary of political turmoil and fiery nationalism.

Yet smaller numbers don't lessen Samak's burden in tackling the PAD, says Panitan Wattanayagorn, a professor at Chulalongkorn University in Bangkok. Sending riot police to oust them, as was attempted last week, could spark mayhem, and the blame would likely fall on the government, not the protestors. "If this crisis ends in bloodshed, regardless of the cause, the prime minister must leave office," he says.

Some PAD supporters want King Bhumipol, a constitutional monarch who has long been a guarantor of political stability, to step in. In 1992, Bhumipol intervened after months of antigovernment street protests ended in a massacre by troops. A royally appointed government was credited with steering the country back to normality.

Korn Chatikavanij, deputy leader of the opposition Democrat Party, says the government's refusal to dissolve parliament or negotiate with the PAD has created a dangerous stalemate. "The only force that could tip the scales one way or another is the military," he says.

Until now, the military has stayed out of the crisis. Samak has aligned himself closely with the current Army chief, who has ruled out staging a coup to end the crisis.

These tensions are belied by the atmosphere at the compound, where middle-class families picnic on ceremonial gardens that usually play host to foreign dignitaries and civil servants. Outdoor market stalls sell clothes, souvenirs, snacks, and camp chairs. Rows of temporary toilets and showers offer relief to round-the-clock demonstrators.

But there's also a mood of fatalism among supporters who recall past political showdowns. "We don't worry about violence. We come in peace. But we're ready for anything," says Marut Asdorn, a truck-company owner.