Prime Minister KP Sharma Oli has resigned amid Nepal's worst unrest in decades, as public anger mounts over the deaths of 19 anti-corruption protesters in clashes with police on Monday.

On Tuesday, crowds set fire to parliament in the capital Kathmandu, sending thick black smoke billowing into the sky. Government buildings and the houses of political leaders were attacked around the country.

Three more deaths were reported on Tuesday. Amid the chaos, jail officials said 900 inmates managed to escape from two prisons in Nepal's western districts.

The demonstrations were triggered by a ban on social media platforms. It was lifted on Monday - but by then protests had swelled into a mass movement.

Nepal's army chief issued a statement late on Tuesday accusing demonstrators of taking advantage of the current crisis by damaging, looting and setting fire to public and private property. It said if unrest continued, all security institutions, including the Nepal Army, are committed to taking control of the situation, without detailing what this might entail.

While the prime minister has stepped down, it's not clear who will replace him - or what happens next, with seemingly no one in charge. Some leaders, including ministers, have reportedly taken refuge with the security forces.

So far, the protesters have not spelled out their demands apart from rallying under the broader anti-corruption call. The protests appear spontaneous, with no organised leadership.

Inside parliament, there were jubilant scenes as hundreds of protesters danced and chanted slogans around a fire at the entrance to the building, many holding Nepal's flag. Some entered inside the building, where all the windows have been smashed. Graffiti and anti-government messages have been spray-painted on the exterior.

Kathmandu resident Muna Shreshta, 20, was among the large crowd outside parliament. Confronted by endemic corruption, she stated, It has happened now and we are more than happy to witness this and fight for this. I hope this change will bring something that is positive to us.

Last week, Nepal's government ordered authorities to block 26 social media platforms citing compliance. Although the ban was hastily lifted, the protests gained unstoppable momentum.

In the weeks before the ban, a nepo kid campaign, spotlighting the lavish lifestyles of politicians' children and allegations of corruption, had taken off on social media. Thousands of young people first attempted to storm the parliament building on Monday.

On Tuesday, protests continued unabated. A crowd in Kathmandu torched the headquarters of the Nepali Congress Party, part of the governing coalition, and the house of its leader, Sher Bahadur Deuba. The house of KP Oli was also set on fire.

He stated he resigned to pave the way for a constitutional solution to the current crisis. An aide to President Ramchandra Paudel confirmed the resignation and that discussions for a new leader had commenced.