Image copyright Reuters Image caption Hani Mulki had refused to scrap a controversial tax bill

Jordan's Prime Minister Hani Mulki has resigned after days of protests against tax rises and austerity measures.

The recent demonstrations in the country, which is a key Western ally, are the biggest in years.

Protesters have chanted anti-government slogans and clashed with police, who have fired tear gas and blocked roads.

The demonstrators say a new tax bill backed by the International Monetary Fund (IMF) will hurt the poor and middle class.

The protests have continued for four consecutive nights, and police say dozens of people have been detained and more than 40 members of the security forces have been injured.

Why did the prime minister raise taxes?

Mr Mulki had refused to scrap the bill, saying it was up to parliament to decide whether to pass it or not.

His government said it needed the money to fund public services and said the new tax bill would mean higher earners pay more.

But protesters feared it would further worsen living standards. In recent years, Jordanians have seen prices rise with salaries failing to keep up.

Image caption Demonstrators have scuffled with police

Mr Mulki was sworn in as prime minister in June 2016. He is a former diplomat and government minister, and the son of former Prime Minister Fawzi Mulki.

On Monday, he was summoned by King Abdullah who demanded his resignation.

"Prime Minister Hani Mulki submitted his resignation to the king this afternoon during a meeting at the Husseiniyeh Palace and the king accepted the resignation," a government source told AFP news agency.

In Jordan, the monarch has extensive powers and can appoint governments and approve legislation.

King Abdullah has reportedly asked Omar al-Razzaz, the education minister and a former World Bank economist, to form a new government.

Earlier this year, sales tax was increased and bread subsidies were scrapped as part of a plan to cut the country's debt.

Mr Mulki said he hoped the reforms, which were needed to get Jordan's economy "back on track", would be complete by mid-2019.

Why is Jordan important?

Jordan is a key Western ally and was largely spared the major turmoil that led to the overthrow of long-term leaders in Egypt and Tunisia and the outbreak of war in neighbouring Syria in 2011.

But as a country with limited natural resources which now hosts over 700,000 refugees - most of them from the Syrian conflict - Jordan has been deeply affected by the events of the Arab Spring. The situation has been compounded by high rates of unemployment and inflation.

Protests have broken out in Jordan before, most notably in response to high fuel costs or the withdrawal of subsidies, but King Abdullah remains a unifying force.

The country hosts foreign military forces active in the Syria conflict and is a major recipient of US aid. After the capture and brutal murder of one of its pilots by the Islamic State group in 2015, Jordan launched air strikes against it.