It's a good thing we're not racing headlong into a war with Iran or some other equally daunting geopolitical catastrophe, because the task of actually filling the Pentagon's top job is starting to look like an increasingly messy task.

After Acting Secretary of Defense Patrick Shanahan withdrew from consideration for permanent secretary, President Donald Trump tapped Army Secretary Mark Esper to take over as his second Acting Secretary of Defense in five months.

But unfortunately for both Trump and Esper, a federal law from 1998 puts a number of legal hurdles in their way.

As Steve Vladeck, a law professor at the University of Texas who focuses on national security and constitutional law, among other things, pointed out on Friday, the period we've gone without a Senate-confirmed defense secretary is three times as long the previous record.

Bu while Trump has said previously that he likes having secretaries in acting capacities because it gives him “more flexibility,” the Federal Vacancies Reform Act of 1998 (FVRA) puts limitations on acting secretary roles, which put the the Pentagon in murky territory when Esper formally steps into the role on June 24.

For starters, in compliance with the FVRA, the person nominated to a position is typically not allowed to serve in that position in an acting capacity. If Trump officially nominated Esper for Defense Secretary, he would not be allowed to serve as the Acting Defense Secretary while his nomination was under consideration.

Shanahan was an exception to this rule because he, as Deputy Secretary of Defense, was “first assistant” to the Secretary; according to an explanation of the FVRA from the Congressional Research Service (CRS), only the “first assistant” to an office may bypass that rule.

Vladeck told Task & Purpose in an email that in the case that Esper is nominated and has to step aside as the acting secretary while his nomination is being considered, the position, “by default,” would go to Navy Secretary Richard Spencer, although Trump “would be free to name someone else as long as that person is eligible under the FVRA.”

Another limitation is time. There is a 210-day deadline for a person to serve in an acting capacity, beginning on the day that the position becomes vacant. This applies to the office, notthe person in office, which means that the moment he takes office, Esper will be effectively running out the clock on Shanahan's 210-day tenure in the role — which ends on July 30th, 2019.

“This period does not begin on the date an acting officer is named,” legislative attorney Valerie Brannon wrote for the CRS. “And because it runs continuously from the occurrence of the vacancy, the time limitation is unaffected by any changes in who is serving as acting officer.”

Vladeck clarified that if the nomination is sent to the Senate before that 210-day limit expires, the time limit extends for as long as the nomination is pending. But because Shanahan's nomination was never sent to the Senate, that clock has continued ticking down since January 1, 2019.

And when, or if, the Senate Armed Services Committee receives Esper's nomination from the White House, it has to wait seven days before taking it up for discussion. To make matters more tense, Congress goes on recess for a week for the Fourth of July, starting on July 1st and again for about a month on August 5th.

The New York Times reported on Friday that the White House does intend to nominate Esper to the secretary position — CNN reported that Esper has already started filling out the paperwork for his nomination — along with Army Under Secretary Ryan McCarthy to take over as Army secretary.

McCarthy would be able to serve in an acting capacity while his nomination is being considered, as he is was the “first assistant” to the Army Secretary job as Army Under Secretary.

It's unclear what happens if we hit the 210-day deadline with no confirmed secretary, and without a nomination sent to the Senate, but the timeline is getting tighter by the day.

If that happened, Vladeck said simply, “we'd have a real big mess.”

SEE NEXT: As The US Sends 1,000 More Troops To Middle East, The Pentagon Is A Rudderless Ship Caught In A Stor