Bangladesh's military was in control of the country on Tuesday after mass protests forced longtime ruler Sheikh Hasina to resign and flee.

Hasina, 76, had been in power since 2009 but was accused of rigging elections in January and then watched millions of people take to the streets over the past month demanding she step down.

Hundreds of people died as security forces sought to quell the unrest, but the protests grew and Hasina finally fled Bangladesh aboard a helicopter on Monday as the military turned against her.

Bangladesh army chief General Waker-Uz-Zaman announced Monday afternoon on state television that Hasina had resigned and the military would form a caretaker government.

"The country has suffered a lot, the economy has been hit, many people have been killed -- it is time to stop the violence," said Waker, shortly after jubilant crowds stormed and looted Hasina's official residence.

Millions of Bangladeshis flooded the streets of Dhaka after Waker's announcement.

"I feel so happy that our country has been liberated," said Sazid Ahnaf, 21, comparing the events to the independence war that split the nation from Pakistan more than five decades ago.

"We have been freed from a dictatorship. It's a Bengal uprising, what we saw in 1971, and now seeing in 2024."

But there were also scenes of chaos and anger, with police reporting at least 66 people killed on Monday as mobs launched revenge attacks on Hasina's allies.

Protesters stormed parliament and torched TV stations, while some smashed statues of Hasina's father, Sheikh Mujibur Rahman, the country's independence hero.

Others set a museum dedicated to the former leader on fire, flames licking at portraits in destruction barely thinkable just hours before, when Hasina had the loyalty of the security forces under her autocratic grip.

"The time has come to make them accountable for torture," said protester Kaza Ahmed. "Sheikh Hasina is responsible for murder."

Offices of Hasina's Awami League across the country were torched and looted, eyewitnesses told AFP.

The unrest began last month in the form of protests against civil service job quotas and then escalated into wider calls for Hasina to stand down.

Her government was accused by rights groups of misusing state institutions to entrench its hold on power and stamp out dissent, including through the extrajudicial killing of opposition activists.

At least 366 people died in the unrest that began in early July, according to an AFP tally based on police, government officials and doctors at hospitals.

- Political vacuum -

Waker said a curfew would be lifted on Tuesday morning, with the military set to lead an interim government.

Bangladeshi President Mohammed Shahabuddin late Monday ordered the release of prisoners from the protests, as well as former prime minister and key opposition leader Khaleda Zia, 78.

Zia, who is in poor health, was jailed by her arch-rival Hasina for graft in 2018.

The president and army chief also met late Monday, alongside key opposition leaders, with the president's press team saying it had been "decided to form an interim government immediately".

It was not immediately clear if Waker would lead it.

Hasina's fate was also uncertain.

Hasina, 76, fled the country by helicopter, a source close to the ousted leader told AFP.

Media in neighbouring India reported Hasina had landed at a military airbase near New Delhi.

A top-level source said she wanted to "transit" on to London, but calls by the British government for a UN-led investigation into "unprecedented levels of violence" put that into doubt.

There were widespread calls by protesters to ensure Hasina's close allies remained in the country.

Bangladesh's military said they had shut Dhaka's international airport on Monday evening, without giving a reason.

Bangladesh has a long history of coups.

The military declared an emergency in January 2007 after widespread political unrest and installed a military-backed caretaker government for two years.

Michael Kugelman, director of the South Asia Institute at the Washington-based Wilson Center, warned that Hasina's departure "would leave a major vacuum" and that the country was in "uncharted territory".

"The coming days are critical," he said.

UN Secretary-General Antonio Guterres stressed the importance of a "peaceful, orderly and democratic transition", his spokesman said. European Union foreign policy chief Josep Borrell echoed that call.

Former colonial ruler Britain and the United States meanwhile urged "calm".