A federal judge struck down an Obama administration mandate requiring doctors to perform gender transition procedures, deeming it in violation of conscience protections for medical professionals.

Tuesday's order, a response to lawsuits by an association of medical professionals filed soon after the mandate went into effect, confirms two prior rulings against the regulation. The mandate was implemented by the Department of Health and Human Services in 2016, toward the end of the Obama administration, and required doctors to perform sex reassignment procedures on any patient referred to them by a mental health professional. Doctors who refused to do the procedures because of moral objections risked losing their job.

Tuesday's decision by the U.S. District Judge Reed O'Connor of the Northern Division of Texas contends the regulation infringed on the conscience rights of doctors morally opposed to sex reassignment surgery. Two federal courts ruled similarly in 2016 that the mandate violated conscience rights.

The Department of Health and Human Services proposed a new rule earlier this year to comply with the 2016 rulings, but the mandate has remained in effect while the new regulation is finalized. The proposed rule met resistance from transgender rights advocates, who suggested doing away with the Obama-era mandate would open the door to hospitals discriminating against transgender patients.

[Read more: Warren: Saying taxpayers shouldn't pay for transgender surgery inmates 'a bad answer']