WASHINGTON — The two-year federal budget deal signed into law Friday morning should stave off the threat of more government shutdowns until late 2019, giving agencies like the Department of Defense a level of budget stability missing in recent years.

But finalizing the deal still resulted in last-minute political drama and a nine-hour shutdown which caused confusion and aggravation for hundreds of thousands of government workers worldwide.

On the East Coast, civilian workers at the Pentagon and military bases arrived to their morning shifts and were told to wait in place until the president signed the budget agreement into law (which happened at 8:45 a.m.). Furlough letters were again prepped overnight, but weren’t used by most offices.

Overseas military bases saw more problems. Since the shutdown began at midnight Thursday in Washington, D.C., many of those operations were shuttered for the day while Congress stumbled through procedural roadblocks on the budget legislation.

Non-essential travel plans were halted. Daycares and medical clinics closed. Armed Forces Network programming stopped broadcasting.

While brief, the shutdown was the second time this year that Congress and the White House failed to meet deadlines for expiring appropriations measures. The prior one came last month when Senate Democrats objected to Republican leaders handling of immigration issues, partially closing government offices for three days.

That shutdown produced hundreds of thousands of furloughs (albeit most only for one day) and cancelled training for thousands of guardsmen and reservists nationwide. Administration officials said they worked to minimize the impact of that shutdown, but warned it still severely impacted military readiness and morale.

This one was more unexpected, with a majority of lawmakers supporting the six-week budget extension and two-year overarching budget plan announced Wednesday.

But just hours before the deadline to pass the measure, Sen. Rand Paul, R-Ky., announced he would not allow the measure to be fast-tracked through that chamber without a vote on his amendment to restore federal spending caps, largely a symbolic protest move.

His actions delayed Senate and House votes on the measure until early Friday morning. Lawmakers are optimistic now with the two-year budget plan in place, they won’t see a repeat of those kinds of shutdown problems again for at least 22 more months.

In a statement Friday morning, Senate Armed Services Committee Chairman John McCain, R-Ariz., said the newly-passed plan gives the Defense Department “the budget certainty it needs to begin the process of rebuilding the military, restoring readiness, and modernizing our forces.

House Armed Services Committee Chairman Mac Thornberry, R-Texas, offered similar praise, saying that “for too long our troops have been made hostages for other political agendas.”

A full-year budget plan has proven elusive for lawmakers for the last two years, and government operations have been funded through a series short-term spending extensions since the start of October. Pentagon officials have repeatedly lamented that, saying it limits new program starts and long-term equipment purchases.

Earlier in the week, Defense Secretary Jim Mattis chastised lawmakers for the patchwork budget process, calling it an “abrogation of (Congress’) constitutional responsibility to provide sufficient, stable funding.”

The new budget deal sets defense discretionary spending at $700 billion for fiscal 2018 and $716 billion for fiscal 2019, both sizable jumps from the $634 billion level in fiscal 2017. Republican lawmakers and President Donald Trump had been arguing for months that a significant increase was needed to rebuild military might and keep up with national security demands.

But Democrats had insisted those funding boosts be tied to increases in non-military spending as well. The deal adds $131 billion in new non-defense spending for fiscal 2018 and 2019, about $34 billion less than the total military hike.

Lawmakers will now spend the next six weeks working out the specifics of how the fiscal 2018 money will be allotted, then shift attention to the 2019 budget process with hopes of finalizing that work before the new fiscal year starts on Oct. 1.

Similar past multi-year budget deals have blunted the threat of a shutdown by removing most of the political spending fights from the more technical work of crafting appropriations bills.

Before the House vote Friday morning, House Appropriations Committee Chairman Rodney Frelinghuysen, R-N.J., said the new plan “will help the nation move forward without the threat of a shutdown” and “move past the destructive cycle of continuing resolutions, which undermines the resolution process and puts until doubt about this Congress’ ability to function.”

After signing the bill, Trump took to social media to praise the defense funding aspects but added “we were forced to increase spending on things we do not like or want in order to finally, after many years of depletion, take care of our Military.” He said the fight shows the country “must elect more Republicans in 2018 Election!”

Along with the short-term spending authorities and two-year spending overview, the budget legislation includes a suspension of the national debt limit until March 2019, $89.3 billion in new disaster assistance aid, and an extension of the Children’s Health Insurance Program through 2027. It does not include new immigration provisions, separating that issue from the budget debate for now.

Details of Trump’s fiscal 2019 budget proposal are expected to be released early next week. Lawmakers will be reviewing those plans as they finalize the fiscal 2018 appropriations bills over the next six weeks.