The Defense Department plans to allow transgender people to enlist in the military starting Jan. 1, Pentagon officials confirmed to Fox News on Monday, after a federal court ordered the military to do so despite opposition from President Trump.

The president over the summer announced, via Twitter, a ban on transgender servicemembers. But the directive has since been challenged in the courts, and a federal judge last month said the U.S. military must accept them starting Jan. 1.

The new policy reflects growing legal pressure on the issue and the difficult hurdles the federal government would have to cross to enforce Trump's demand.

Potential transgender recruits will still have to overcome a lengthy and strict set of physical, medical and mental conditions that make it possible, though difficult, for them to join the armed services.

Maj. David Eastburn, a Pentagon spokesman, says the enlistment of transgender recruits will start Jan. 1 and go on amid the legal battles. The Defense Department also is studying the issue.

Eastburn told The Associated Press on Monday that the new guidelines mean the Pentagon can disqualify potential recruits with gender dysphoria, a history of medical treatments associated with gender transition and those who underwent reconstruction. But such recruits are allowed in if a medical provider certifies they've been clinically stable in the preferred sex for 18 months and are free of significant distress or impairment in social, occupational or other important areas.

Transgender individuals receiving hormone therapy also must be stable on their medication for 18 months.

Last year, then-Defense Secretary Ash Carter ended the ban on transgender service members, allowing them to serve openly in the military. He said that within 12 months -- or by July 2017 -- transgender people also would be able to enlist.

Trump, however, tweeted in July that the federal government "will not accept or allow" transgender troops to serve "in any capacity" in the military. A month later, he issued a formal order telling the Pentagon to extend the ban. He gave the department six months to determine what to do about those currently serving.

Trump's decision was quickly challenged in court, and two U.S. district court judges have already ruled against the ban. Part of one ruling required the government to allow transgender individuals to enlist beginning Jan. 1.

"We disagree with the Court's ruling and are seeking to stay the Defense Department's obligations under that ruling as we evaluate next steps. Plaintiffs’ lawsuit challenging military service requirements is premature for many reasons, including that the Defense Department is actively reviewing such service requirements, as the President ordered, and because none of the Plaintiffs have established that they will be impacted by current policies on military service," Justice Department spokeswoman Lauren Ehrsam told Fox News.

The government had asked that the Jan. 1 requirement be put on hold while the appeal proceeds. The Pentagon move Monday signals the growing sense within the government that authorities are likely to lose the legal fight.

Fox News’ Jake Gibson, Lucas Tomlinson and The Associated Press contributed to this report.