Fears are growing over an increasingly febrile security situation in Haiti after police and soldiers fought a deadly gun battle which lasted for hours outside the country’s presidential palace.

The exchange of gunfire on Sunday shattered the opening of Haiti’s annual carnival as police and soldiers exchanged volleys of gunfire sending bystanders diving for cover.

One soldier died of his wounds on Monday and at least three police officers were wounded.

Shooting continued into the night, and in the immediate aftermath, authorities in the impoverished Caribbean country announced the cancellation of the carnival warning of the risk of a “bloodbath”.

The violence broke out when protesting police officers, some in plainclothes and wearing masks, used the opening of the carnival to stage the latest in a series of demonstrations against poor work conditions and demanding to be allowed to unionize.

Armed off-duty police officers protest over pay and working conditions in Port-au-Prince on Sunday. Photograph: Dieu Nalio Chery/AP

As the protesters were stopped by soldiers near the imposing white building of the presidential palace the two sides began firing at each other.

Caraibes, a local radio and television station also came under attack.

Some reports suggested that the gun battle began when demonstrating police officers shot into the air. As the exchanges became more serious it appears that fire was directed into the square from a prominent tower nearby.

Officers gesture for all sides to cease fire during a clash in Port-au-Prince on Sunday. Photograph: Dieu Nalio Chery/AP

The clash between police and military comes in the middle of a long-running political crisis that has seen intermittent mass protests against the government of Jovenel Moïse over a corruption scandal and 2017’s contested elections, which the opposition has never accepted.

Video footage from the square showed dozens of people trying to take cover behind kerb stones while helmeted police, some of them in body armour, fired pistols and rifles across the city’s Champ de Mars park.

The Haitian government issued a statement late on Sunday strongly condemning the violence, calling it an attack against freedom and democracy, noting that it was difficult to assess the scope of the violence.

“Terror reigned in certain areas,” the statement said. “Streets were obstructed and there was a warlike situation at the Champ de Mars, where heavy weapons fire was heard almost all day.”

A man rolls a flaming tire during clashes at the presidential palace in Port-au-Prince on Sunday. Photograph: Jean Marc Herve Abelard/EPA

A stage built by the ministry of defence and guarded by the army was also set on fire.

“No money for police officers but enough money for carnival,” protesters shouted. It was the final straw after a series of other challenges, they said.

“We’ll continue to demonstrate,” said one masked protester who declined to be identified for fear of reprisal. Local television showed footage of two cars set on fire while local radio reported several were wounded and one died.

Haiti has witnessed a spike in kidnappings for ransom since the beginning of the year and fighting between rival crime gangs, which regularly set up roadblocks on Haitian highways.

One in three Haitians, about 3.7 million people, needs urgent food assistance, up from 2.6 million people at the end of 2018. Haiti ranks 111 out of 117 countries on the Global Hunger Index, near poor sub-Saharan African countries.