Media playback is unsupported on your device Media caption "There are plenty of soldiers posted near this, the main protest camp, but they could not prevent" the attack, reports Jonathan Head

Three people have been killed and more than 20 others injured in an attack on an anti-government protest camp in the Thai capital, officials say.

Witnesses reported explosions and gunfire early on Thursday at a protest camp at Bangkok's Democracy Monument.

Protesters have been pressing the Senate to replace the cabinet with an appointed administration.

On Thursday, Thailand's military chief warned that the army could "use force" if political violence continued.

"If violence continues the military may need to come out... to restore peace and order," General Prayuth Chan-ocha said in a statement, adding that the army could be forced to end the violence "in full force".

However, a coup is not thought to be likely, correspondents say, as the military has frequently said that it does not believe this will resolve the political crisis.

Meeting abandoned

Analysis In a country with a history of military coups, any warning of "decisive action" by the army commander, at a time of chronic political tension, will set off alarm bells. But it probably won't happen, at least not yet. After a spate of similar attacks in February, the army deployed troops in bunkers all over Bangkok - setting off more coup chatter - and promised to protect the anti-government People's Democratic Reform Committee (PDRC). There were plenty of soldiers around Democracy Monument when it was hit by grenades and bullets this morning, and they were powerless to stop them. General Prayuth will have been embarrassed by this, and his strong statement probably reflects that. He is also sending a warning to the secretive armed "red shirt" militants, whom the PDRC blames for the latest attack. These militants are not commanded by the mainstream red shirt movement, which has restrained its followers from any clashes with the PDRC. It is the prospect of an armed response by these militants, thought to number several thousand, which has helped deter even army hardliners from intervening up to now, along with the fear that they would be left in charge of a mess. The army top brass has repeatedly said it does not believe a coup can solve Thailand's crisis. That does not mean it won't happen. The current government is still likely to be forced out of office, but the generals would clearly prefer that this is done by judges or senators, rather than at the point of a gun.

Thailand has suffered months of deadlock since the protest campaign began in November, with at least 27 people killed and hundreds wounded.

Also on Thursday, protesters forced a meeting between the government and the Election Commission to be abandoned.

A crowd led by Suthep Thaugsuban, head of the anti-government movement, broke into the Air Force base where the meeting between acting Prime Minister Niwatthamrong Boonsongphaisan and the commission was being held.

"The meeting is over, the prime minister is leaving. We cannot continue today," a member of the commission was quoted by Reuters news agency as saying.

The Election Commission on Thursday has called for polls to be postponed due to the political unrest, AFP news agency says, citing officials.

Power struggle

Reports said grenades were thrown in the latest attack in the early hours of Thursday, followed by gunfire. A doctor at an emergency centre in Bangkok said the wounded had been hit by shrapnel.

Police identified two of the victims as a protester who was asleep and a protest guard who was shot.

There have been a number of attacks on the protest movement since it began its street campaign against the government last year, says the BBC's South East Asia correspondent Jonathan Head, but this was on a larger scale than usual.

No group has said it carried out the attack but both pro- and anti-government groups are known to have armed hardliners.

Image copyright AP Image caption Protesters have been trying to oust the government since November 2013

Image copyright AP Image caption They interrupted a meeting between the acting prime minister and the Election Commission on Thursday

Image copyright AP Image caption The crowd that arrived at the air force base was led by Suthep Thaugsuban

The attack on protesters comes days after former Prime Minister Yingluck Shinawatra was removed by a Thai court.

Ms Yingluck was swiftly replaced by former Commerce Minister Niwattumrong Boonsongpaisan, who is from her ruling Pheu Thai party.

The party, which won elections in July 2011, says it will push on with a plan to hold another general election in July.

The protesters say they will obstruct this poll in the same way that they blocked an election held in February that was subsequently annulled by the courts.

Thailand's troubles

Image copyright AP

Sep 2006: Army ousts Thaksin Shinawatra

Dec 2007: Pro-Thaksin party wins election

Aug 2008: Thaksin flees Thailand

Dec 2008: Huge anti-Thaksin protests; court bans ruling party; Abhisit Vejjajiva comes to power

Mar-May 2010: Huge pro-Thaksin protests; more than 90 killed over 10-week period

Jul 2011: Yingluck Shinawatra elected PM

Nov 2013: Anti-government protests

Feb 2014: Snap election held, but protesters disrupt polls; court rules polls invalid

May 2014: PM ordered to step down

Thailand has been in the grip of a power struggle since Ms Yingluck's brother, Thaksin Shinawatra, was ousted by the military as prime minister in a 2006 coup.

Mr Thaksin and his family are hated by an urban and middle-class elite who accuse them of corruption and abuse of power.

But Mr Thaksin's policies won him huge support in rural areas, and both the elections since the coup have returned Thaksin-allied governments to power.

The current anti-government protesters want to replace Ms Yingluck's administration with an unelected "people's council" which, they say, would reform the political system.

Both pro- and anti-government groups have held rallies in Bangkok in recent days, raising fears of further violence.