Updated

Thai police used tear gas to disperse a crowd of several thousand anti-government protesters who were besieging city police headquarters. The prime minister said he might declare a state of emergency if the rioting worsens.

Associated Press journalists witnessed police throwing dozens of canisters of gas at the crowd of at least 2,000 people. Protest leaders claimed they had come to demand the surrender of officers who allegedly beat demonstrators earlier in the day.

Click here to see photos.

Tensions rose Friday, three days after members of the People's Alliance for Democracy occupied Prime Minister Samak Sundaravej's office compound to demand his ouster.

The alliance accuses Samak's government of serving as a proxy for former Prime Minister Thaksin Shinawatra, who was ousted in a 2006 coup and faces several pending corruption cases. Thaksin is in self-imposed exile in Britain.

Alliance sympathizers also staged actions in other parts of the country, causing railway and airline delays and cancellations.

More than 200 railway workers staged a work stoppage by taking emergency sick leave, forcing the cancellation of 35 trains from Bangkok to major provinces, said State Railways of Thailand spokesman Pairat Rojcharoen-ngarm.

Protesters also tried to block passengers from entering three airports in southern Thailand, at Hat Yai, Krabi and the popular tourist destination of Phuket. Airport authorities announced that all three airports would close Friday night for safety reasons, causing flights in and out to be canceled.

Earlier Friday, several skirmishes erupted outside the Government House as police and protesters jockeyed for position.

In the morning, police muscled into the site to deliver a court eviction demanding that the alliance members leave the site. Several minor injuries were reported throughout the day as brief skirmishes erupted around the perimeter of the compound and in nearby streets.

Police then announced that they would retreat in order to ease tensions.

"The situation was very volatile and a clash was likely if we pushed on," police spokesman Surapol Tuantong told the NBT TV network. "We have given way to let them back into the Government House to prevent a clash. All security forces have left the government compound."

But protesters then descended on the police station.

"We went there to demand responsibility from the police who ordered the beatings of protesters," said alliance spokesman Suriyasai Katasila. "They responded by firing tear gas at us."

About 10 people suffered minor injuries in that clash.

Earlier, Sondhi Limthongkul, a protest leader, vowed to continue the protests until Samak steps down.

"We definitely won't leave the Government House until we can topple Samak's administration," Sonthi told The Associated Press. "He cannot stay on for long, I am very sure of that. You can see people coming more and more to join us."

Sondhi promised that the alliance would install a "clean and efficient political system."

Arrest warrants were issued Wednesday for nine of the group's leaders on charges of insurrection, conspiracy, illegal assembly and refusing orders to disperse. Insurrection, the legal equivalent of treason, carries a maximum penalty of death or life imprisonment.

Another court issued an order late Wednesday demanding that the protesters leave the government compound immediately and stop blocking streets. But on Friday, the court suspended the order, saying it posed a risk of further unrest.

Samak, who refuses to resign, has accused the protesters of trying to provoke violence.

After Thaksin was deposed in the bloodless coup, his party was dissolved and he was banned from public office until 2012.

But Samak led Thaksin's political allies to a December 2007 election victory, and their assumption of power triggered fears that Thaksin would make a political comeback on the strength of his continued popularity in Thailand's rural majority.

Thailand has had 17 constitutions since 1932 — a reflection of the political instability and military coups that followed the drafting of the first charter that created a constitutional monarchy. The last coup was in 2006, when Thaksin was ousted.

The prime minister spoke Friday after two meetings with the country's military chiefs to discuss the increasing unrest in Bangkok's streets caused by protesters seeking his resignation.

Samak says he had ordered police to withdraw from confronting demonstrators because he hoped to calm down the situation, in which both sides scuffled roughly in the street.

But he says that after he hosts a ceremony honoring Thailand's royal family Saturday, he will consider declaring a state of emergency if the situation deteriorates.

That would allow suspending some legal procedures to restore the peace.