Hong Kong’s chief executive Carrie Lam has offered to resign on several occasions in recent weeks over mass protests in the territory but Beijing has refused to let her stand down, according to two people with direct knowledge of the situation.

The demonstrations were sparked by an attempt by Ms Lam to push through an extradition bill that would allow criminal suspects to be sent to mainland China for trial, with public opposition so heated protesters stormed the territory’s de facto parliament this month.

The situation has escalated into the territory’s deepest political crisis since its handover from British to Chinese sovereignty 22 years ago, prompting Ms Lam’s offer to stand down over her handling of the bill, the people with direct knowledge of the situation said.

Beijing, however, has insisted that Ms Lam “has to stay to clean up the mess she created”, according to one person with direct knowledge of the situation. “No one else can clean up the mess and no one else wants the job.”

The demonstrations began this year, culminating in Hong Kong’s biggest protest on record last month involving up to 2m people. Initially, they were focused on the extradition bill but have expanded to encompass other issues worrying Hong Kong’s population.

On Sunday, tens of thousands of protesters marched through an area popular with mainland Chinese shoppers in Sha Tin, northern Hong Kong. The largely peaceful rally ended with running clashes between the protesters and the police in a nearby shopping mall. A small group of angry demonstrators threw projectiles, including umbrellas and bottles, at the police, who used pepper spray and batons, and made about 40 arrests.

The clashes came a day after confrontations at a demonstration near the territory’s border with the Chinese metropolis of Shenzhen against what Hong Kongers see as an invasion by small traders from mainland China.

Following mass protests in June, Ms Lam suspended the proposed extradition law, saying it was “dead” and admitting that her administration’s work on the bill was “a total failure”.

But demonstrators have continued to demand the full withdrawal of the proposed legislation.

When asked by the Financial Times if Ms Lam had attempted to resign, her office said: “The chief executive has made it clear in public that she remains committed to serving the people of Hong Kong.”

The Hong Kong and Macao Affairs Office, Beijing’s government department in charge of supervising the territory, did not respond to a request for comment.

On Thursday, Wang Zhimin, head of Beijing’s liaison office in Hong Kong, publicly backed Ms Lam, saying the central government “firmly supports” the chief executive and her government, Reuters reported.

The bill was Ms Lam’s initiative and not Beijing’s, the people with direct knowledge of the situation said.

That has left Ms Lam as the target both for public criticism among Hong Kongers and China’s displeasure at the handling of the controversy.

The crisis has renewed questions about the viability of the “one country, two systems” model under which Hong Kong has been governed since the handover of the city from British to Chinese rule in 1997.

This allowed for a high degree of political and legal autonomy from Beijing for 50 years but has meant that chief executives — who are appointed by Beijing — face the difficult task of balancing the interests of Hong Kongers with the will of mainland China.

The careers of all three previous Hong Kong leaders have ended badly.

Tung Chee-hwa, the first post-handover chief executive, resigned in 2005 after 500,000 people protested against an anti-subversion bill in 2003 and Beijing publicly criticised his performance.

Donald Tsang, who succeeded Mr Tung, became the highest-ranking politician to be jailed on charges of misconduct in Hong Kong.

CY Leung, Ms Lam’s predecessor, stepped down after his first term rather than serve a second five-year term after the city was rocked by the pro-democracy Occupy Movement in 2014, which brought Central Hong Kong to a standstill for 79 days.

With additional reporting by Ravi Mattu in Hong Kong