Stormont's health minister did not have the power to keep an "irrational" lifetime ban on gay men giving blood in Northern Ireland, a judge has ruled.
The High Court judge also found that Edwin Poots had breached the ministerial code by failing to take the issue before the Stormont Executive.
The Department of Health said Mr Poots would "read and consider" the verdict.
The complete ban, put in place during the 1980s, was lifted in England, Scotland and Wales in November 2011.
It was replaced by new rules that allow blood from men whose last sexual contact with another man was more than a year ago.
The 12-month deferral was left in place following a Government Advisory Committee report.
Beyond religious belief
It identified a much shorter period during which infection with blood-borne viruses could not be detected.
Mr Poots maintained the ban in Northern Ireland on the basis of ensuring public safety.
But a gay man granted anonymity due to his perceived vulnerability launched a judicial review challenge to Mr Poots' position on blood donation.
The judge heard claims that the minister had displayed apparent bias that went beyond religious beliefs and into the realms of prejudice.
It was revealed in court that despite the unidentified applicant's sexual orientation, he has become a born-again Christian who now disapproves of homosexual practices.
Attorney General John Larkin QC, the chief legal adviser to the Stormont Executive, questioned the legitimacy of the challenge.
He claimed the challenge was a waste of time because the applicant had previously had sex for money.
Mr Larkin rejected arguments that the issue required full executive approval and questioned whether the minister had made a decision to maintain the current ban.
However, the judge said that in continuing the lifetime deferral policy the minister had deviated from the position taken in England, Scotland and Wales.
'Defect in reason'
He said the decision was made against the secretary of state's recommendation that the report from the advisory committee on the Safety of Blood, Tissues and Organs (SaBTO) should be followed.
The judge held that the additional risk from deferring donation for 12 months, instead of permanently, was very minimal.
He said: "The minister has decided that MSM (males who have sex with other males) behaviour creates such a high risk of infection to the donor that such donors must be permanently deferred with the result that such blood cannot enter the Northern Ireland blood stock.
"Importing blood from other places which do accept MSM donors, even in limited quantities, leaves the door open for MSM blood to do just that.
"There is clearly a defect in reason here."
Applying different standards to imported blood defeats the whole purpose of a permanent deferral, he added.
Declaring the decision irrational, he said: "If there is a genuine concern about the safety of MSM-donated blood, such that the blood stock must be protected absolutely from such blood, then the security of that blood must actually be maintained absolutely."
Dealing with the alleged breach of the ministerial code, the judge said the lifetime ban was both controversial and cross-cutting, taking in equality issues.
"As such the minister had no authority to act without bringing them to the attention of the Executive Committee which he failed to do.
"In doing so the minister breached the ministerial code and... had no legal authority to take a decision in breach of the ministerial code."
In response to the judgement, a spokesperson for UK Health Secretary Jeremy Hunt said: "We will consider the potential implications of this judgement on UK blood policy."
Sinn Féin assembly member Maeve McLaughlin, who is currently the chair of Stormont's health committee, said: "The decision raises in many people's minds serious questions as to whether Edwin Poots has the ability to carry out his duties as health minister for all."
She added: "It goes without saying that we need to have robust screening of blood, whoever it comes from. Discriminating against people from within our community who are prepared to give blood, which would be used to save lives, needs to be reversed immediately."
Alliance Party health spokesman Kieran McCarthy said the DUP MP's position as health minister had been "seriously compromised" and he should "consider his position".
"He has been badly advised and now has serious questions to answer. Not only has he wasted public funds, but he also acted to prejudice one section of society in Northern Ireland," he said.
John O'Doherty of the Rainbow Project, a gay advocacy organisation, said: "This ruling is a shocking indictment of the conduct of Minister Poots, who has proven himself incapable of separating his personal prejudices from his public responsibilities."