The Home Office has reversed a decision to order a young doctor to leave the country.
Mu-Chun Chiang, who has lived in the UK for 13 years, was told that due to an "administrative issue" she had to leave or face up to six months in prison.
A petition calling for the 27-year-old to be allowed to stay in the UK has received nearly 40,000 signatures.
The Home Office said it had reconsidered its decision and granted her leave to remain.
British Medical Association council chair Dr Chaand Nagpaul said it was pleased the government had "finally seen sense", adding that "the strong public reaction goes some way to showing the absurdity of the Home Office's decision to initially deny a visa".
Bank account inquiry
Mina Mesri, who organised the online petition, said: "Mu is delighted with the decision and incredibly grateful to every single one of you who has signed and shared the petition."
She added: "It feels important to acknowledge that Mu is incredibly lucky that her profession is one that triggers such public support, particularly in a time when the NHS is in such crisis."
You may also like
Dr Chiang said previously: "I was worried because we were already understaffed on our ward and leaving all my friends would be really heartbreaking."
The doctor, who is originally from Taiwan, lived in Glasgow from 1997 to 2002 with her parents, and she returned to the UK in 2006 to study.
She received a letter on Friday stating her application had been unsuccessful and she "must leave the UK now" or she would "be liable to be detained and removed".
She applied for a new working visa in August but it was rejected due to a Home Office rule stating that an applicant's bank balance cannot drop below £945 in the 90 days before an application.
The Home Office said it changed its decision in the light of additional evidence supplied by Dr Chiang.