An Egyptian man with a rare genetic disorder facing deportation has won the right to stay in the UK until 2026.
Youssef Mikhaiel was due to be deported in June, within days, but that was postponed after a ruling at the Court of Session in Edinburgh.
The 28-year-old has Fabry disease, which damages the heart, kidneys and nervous system. He cannot access treatment in his home country.
The Home Office has now granted him leave to remain for two years.
In a letter seen by BBC Scotland News, it told the graduate engineer it would exercise discretion due to his "exceptional circumstances".
It comes after Mr Mikhaiel had been held at Dungavel House detention centre in Lanarkshire for two weeks in May and June.
He described the relief he felt following the decision.
Speaking of his initial detention, he said: "Until this moment, I wasn't able to process it.
"You are being treated as a criminal and I didn't have access to the proper medical treatment. You fight for years for treatment and then all of a sudden, you could be deported."
He added: "I can take a breath now. I have skills and would like to invest more in myself.
"And now I can start my treatment. In the beginning, it had stopped until we knew whether I was going to stay or be deported."
Fabry disease in an inherited condition in which enzymes cannot break down fatty materials known as lipids, allowing them to build up in the body.
It is believed to affect one in every 40,000 men, though estimates vary.
Symptoms include chronic pain, high temperatures and an inability to sweat and can shorten a person's lifespan.
Mr Mikhaiel's case hinged on a letter sent by officials at Misr International Hospital in Egypt.
It confirmed that the country's drug authority did not provide a medicine called migalastat, which is used in Scotland to treat the disease.
An annual course of migalastat treatment can cost £210,000, according to the Scottish Medicines Consortium.
It added: "Undoubtedly, the absence of his required treatment for his rare disorder in Egypt would cause intense suffering or death."
Mr Mikhaiel said: "The treatment is not available at all and you don't even have access to proper diagnosis for Fabry disease.
"First of all, this is my life. It affects my lifespan - the maximum is 50 years old for males and I am 28.
"I would like to have career, have a future and build a family.
"So this was critical for my life."
Mr Mikhaiel arrived in Scotland on a student visa in 2016 and graduated in aeronautical engineering at Glasgow University in 2019.
His visa expired the same year and he applied for leave to remain after he was diagnosed with Fabry disease.
His initial application was rejected over a failure to provide evidence of his illness in 2021.
When the Home Office then ordered that he should be removed from the UK, he applied for leave to remain on medical grounds.
However, he was detained and held at Dungavel in May this year - just a day after his lawyer obtained evidence from Egypt.
A petition for judicial review into the decision to detain him was accepted by the Court of Session in June and Mr Mikhaiel was released from detention.
The Home Office has now written to him, confirming it has granted leave to remain until 26 April 2026.
It stated: "Although you do not qualify for leave to remain in the United Kingdom under the immigration rules, it has nonetheless been decided that discretion should be exercised in your favour.
"You have therefore been granted limited leave to remain in the United Kingdom in accordance with the principles set out in the Home Office policy instruction on discretionary leave."
It added that it made the decision "on the basis of [his] exceptional circumstances".
'Questions to be answered'
Mr Mikhaiel's solicitor Usman Aslam said his client should have been released as soon as he provided evidence on treatment in Egypt.
"I think there are a lot of questions that still need to be answered," he said. "He should not have been detained or spent that amount of time in detention.
"What should have happened is that the Home Office should have contacted me.
"We had the evidence from the Egyptian hospital, including the Egyptian drug authority, confirming that he could not have access to that treatment and that it would shorten his life."
After his leave to remain expires, Mr Mikhaiel - who is now studying cybersecurity - will need to apply to extend his stay but he said that access to better treatment had given him "hope".
"It will reduce my symptoms and lessen the pain," he said.
"I will have a longer life, build a career, have a family and hopefully have a happy life."
The Home Office said it did not comment on individual cases.
A spokesperson added: "All applications for leave to remain are carefully considered on their individual merits, on the basis of the evidence provided and in accordance with the immigration rules.
"We only return those with no legal right to remain in the UK and will not return anyone to countries where they have been found to be at risk of persecution or serious harm."