Britain's Border Agency said it would allow asylum for Mehdi Kazemi, who traveled in 2005 to London to study English and while there learned that his lover in Iran had been charged with sodomy and hanged.
Kazemi, 19, then sought asylum in Britain, but it was rejected, then in the Netherlands. The Netherlands' highest court rejected his claim in March, ruling that Britain was responsible for the case under European Union law because it was there that Kazemi first applied for asylum.
Britain's Home Secretary Jacqui Smith decided after that to reconsider the case, and there were appeals in the House of Lords that he be allowed to remain due to fears his life could be at risk in Iran.
Some human rights groups claim gay people are executed in Iran because of their sexuality.
The case has drawn attention in both countries to the plight of homosexuals in Iran, and the differences in the way various EU countries deal with asylum-seekers.