The Department of Defense announced Dec. 11 that it will again allow transgender applicants to join the military starting Jan. 1, 2018, on the heels of a new court ruling against President Donald Trump’s announced ban on transgender service members.

Pentagon spokesman Maj. David Eastburn told the Associated Press that the service could still turn away candidates with “gender dysphoria,” but not if a physician certifies that the candidate has been “stable in the preferred sex for 18 months and are free of significant distress or impairment” in every respect.

“Due to the complexity of this new medical standard, trained medical officers will perform a medical prescreen of transgender applicants for military service who otherwise meet all applicable applicant standards,” Eastburn told AP.

That surprise move — the military had previously said it would study the issue and put out recommendations by January — came as a federal court dealt another blow to Trump’s demand for a ban on transgender people in the service, which he first handed down in a series of tweets last summer, a move that baffled lawmakers and military brass alike.

On Dec. 11, U.S. District Judge Colleen Kollar-Kotelly for the District of Columbia, who had previously ordered the Pentagon to accept transgender troops by Jan. 1, denied the Trump administration’s request to delay implementation of that order, the Washington Post reports.

Given that the U.S. government has “had the opportunity to prepare for the accession of transgender individuals into the military for nearly one and a half years,” when then-defense secretary Ash Carter announced a pro-transgender policy shift in 2016, “the Court is not convinced by the vague claims in declaration that a stay is needed,” Kollar-Kotelly wrote in her decision.

A separate federal court in Baltimore had ruled in November that the Trump administration couldn’t withhold funding for already-serving trans servicemembers’ sex-reassignment surgeries, the Post reports.

Those court rulings, and Pentagon’s snap decision to reopen enlistments next month, mean the next battle between administration lawyers and trans advocates “will not be about whether you allow transgender enlistees, it's going to be on what terms,” Brad Carson — the former undersecretary of defense personnel and readiness who helped implement Carter’s pro-transgender policy in 2016 — told the AP. “That's really where the controversy will lie.”