It is the biggest budget the Pentagon has ever seen: $700bn. That's far more in military spending than the US' two nearest competitors, China and Russia, and will mean US army can foot the bill for thousands more troops, more training, more ships and a lot else.

And next year it would rise to $716bn. Together, the two-year deal provides what US Defense Secretary James Mattis says is needed to pull the military out of a slump in combat readiness at a time of renewed focus on the stalemated conflict in Afghanistan and the threat of war on the Korean Peninsula.

The budget bill that President Donald Trump signed Friday includes huge spending increases for the military: The Pentagon will get $94bn more this budget year than last - a 15.5 percent jump. It's the biggest year-over-year windfall since the budget soared by 26.6 percent, from $345bn in 2002 to $437bn the year after, when the United States invaded Afghanistan and Iraq, and was expanding national defence after the attacks September 11, 2001.

The extra money is not targeted at countering a perceived new enemy or a singular threat like al-Qaeda or the former Soviet Union. Instead, the infusion is being sold as a fix for a broader set of problems, including a deficit of training, a need for more hi-tech missile defences, and the start of a complete recapitalization of the nuclear weapons arsenal.

Every secretary of defense since 2011, when the Congress passed a law setting firm limits on military and domestic spending, has complained that spending caps set by the Budget Control Act were squeezing the military so hard that the number of ready-to-fight combat units was dwindling. Aging equipment was stacking up, troops were not getting enough training and the uncertain budget outlook was clouding the US' future.

"I cannot overstate the negative impact to our troops and families' morale from all this budget uncertainty," Mattis said just hours before the House and Senate approved the deal.

More money for the Pentagon, however, is not the simple solution some might think. Even with the spending caps of recent years, the military budget has been robust by historical standards. Todd Harrison, a military budget specialist at the Center for Security and International Studies, says military funding has been near the inflation-adjusted peak levels of the armed forces buildup during the 1980s under President Ronald Reagan.

The problem, Harrison says, is that the budgets have been stretched by rising personnel costs, more expensive technology investments and other factors, compounded by the cumulative effects of more than a decade of war in Afghanistan, Iraq and elsewhere in the Middle East. And throughout this period, the military has been required to keep up or even increase its pace of operations at home and abroad - and there is no letup in sight.

"We are stretched too thin," Harrison said Friday. "We are trying to do too much with the size force that we have all around the world. Money doesn't necessarily fix that."

The US has far fewer troops in Iraq than it did 10 years ago, and the roughly 15,000 in Afghanistan today compare with a peak of 100,000 in 2010-11, but the trend is leaning in the opposite direction under President Donald Trump, including stepped up military operations in Somalia and Yemen. Trump has added several thousand troops in Afghanistan. Also, the prospect of war against North Korea looms large as Trump insists on compelling the North to give up its nuclear weapons.

The enormous increases in military spending agreed to by legislators on Friday go beyond what Trump ask for. Of the $700bn in spending for the 2018 budget year that started last October 1, about $629bn is for core Pentagon operations and nearly $71bn is for the wars in Afghanistan and elsewhere.

Trump had requested a 2018 military budget of $603bn for basic functions and $65bn for war missions.

The deal Congress approved early Friday also sets the Pentagon's 2019 budget at $716bn, giving Mattis the financial stability he's been demanding.

The biggest winners in the military buildup are the country's largest defence contractors, such as Lockheed Martin, Boeing and General Dynamics, that spend millions of dollars each year lobbying Congress.

The legislation that Trump signed Friday is expected to translate to billions more for one of the Pentagon's highest priorities: missile defence. The appropriations committees still need to finalise exactly what will be in the 2018 military budget. But they're likely to follow closely the military policy bill approved by Congress late last year. That included $12.3bn for the Pentagon's Missile Defense Agency and ordered a more rapid buildup of US missile defences as North Korea continues to develop its nuclear missiles capability.

The policy bill included money for as many as 28 additional Ground-Based Interceptors - anti-missile missiles that would be launched from underground silos in Alaska. The bill also grants US troops a 2.4 percent pay rise, slightly higher than the Pentagon had proposed.

Before the budget deal was reached, Congress frequently resorted to the use of stopgap spending bills. Under these short-term measures, the Pentagon's budget was locked at current year's levels and the military services can be barred from starting new programmes or ending old ones.

The Pentagon complained that the stopgap approach forced them to shift dollars intended for new weapons and other needed equipment to pay for ongoing operations.