It’s been a topsy-turvy month for the Pentagon’s most expensive weapons program.

Last week, Canadian officials said they were in talks to buy 18 F/A-18 Super Hornets from Boeing as a stopgap measure while they conduct a review to determine what fighter jets the U.S. ally will buy en masse to replace its fleet. The decision dealt a blow to Lockheed Martin, the manufacturer of the F-35 Joint Strike Fighter, which now will have to compete for the business of a country that had once signed up to buy as many as 65 of the stealthy, next-generation aircraft.

Then on Sunday, the F-35 program received a bit of good news when Israel approved the purchase of an additional 17 jets.

While the United States intends to buy the majority of the F-35s, the program also has a number of key allies that have committed to purchasing the plane. The scale of their purchases is more than a symbol of their confidence in a program that for years had been beset by cost overruns and delays; it is important in helping keeping the cost of the plane down. The more F-35s that are produced, the less expensive they become.

For years, the $400 billion F-35 program was one of the Pentagon’s most troubled. After cost overruns and delays, it has been more stable in the past few years. But as the last few weeks show, drama is inherent in such a high-stakes procurement that involves three of the Pentagon’s military services, several international partners and the world’s largest defense contractor.

Over the past month, there were also twists and turns in the relationship between the Pentagon and Bethesda-based Lockheed, its biggest supplier. After the two sides had been unable to reach an agreement on the price of the latest batch of aircraft, the Pentagon invoked a provision that allowed it to unilaterally execute the contract, setting the price at its last offer.

At $6.1 billion for 57 planes, the deal represented a 3.7 percent price decrease from the previous batch of planes purchased by the Pentagon. But the tension was almost immediately apparent. After the Pentagon proclaimed it was a “fair and reasonable deal,” Lockheed said that it was “disappointed” and that the contract was “not mutually agreed upon.”

But last week, the Pentagon awarded Lockheed a nearly $1.3 billion payment to help the contractor continue production of the next batch of aircraft. That contract could be worth as much as $7.2 billion for 90 aircraft, the largest buy yet.

The flurry of activity is emblematic of how the program “continues to grow and expand,” said Joe DellaVedova, a spokesman for the Pentagon’s F-35 Joint Program Office.

Preparations are being made to ramp up production. The Pentagon has declared that two of the three versions of the planes — the Air Force and Marine Corps variants — are ready for combat. The aircraft recently completed tests on the West Coast. And early next year, the Marine Corps plans to deploy its version of the F-35, which can land vertically and take off on a short runway, to Japan.

Israel’s decision to buy 17 more is a boon, and Lockheed is expected to deliver the first two of its fighter jets early next year.

The news from Canada, however, was a setback. The country had planned to purchase the F-35 but changed course after an auditor general’s report suggested that the Canadian government misled Parliament, saying the costs would be higher than had been stated. During his campaign, Prime Minister Justin Trudeau said the country could find an aircraft that was more affordable.

Now Canada plans to hold a competition to replace its fleet. Boeing has waged an intense lobbying campaign in the country to convince it to buy more Super Hornets.

But Lockheed isn’t giving up.

“Although disappointed with this decision, we remain confident the F-35 is the best solution to meet Canada’s operational requirements at the most affordable price,” the company said in a statement. “The F-35 has proven in all competitions to be lower in cost than 4th generation competitors. The F-35 is combat ready and available today to meet Canada’s needs for the next 40 years.”