The Pentagon is suspending its training program for Turkish pilots learning to fly the advanced F-35 Joint Strike Fighter, ordering the roughly 40 trainees to leave the U.S. by the end of July.

Acting Defense Secretary Patrick M. Shanahan made the order on the training program and the decision to expel the Turkish pilots this week. In a letter to Turkish Defense Minister Hulusi Akar, Mr. Shanahan said all Turkish military personnel tied to the program would have their travel orders to the U.S. rescinded and be denied access to U.S. military facilities after July 31.

“This is a disciplined and graceful wind down” of Turkey’s participation in the international fighter program, Undersecretary of Defense for Acquisition Ellen Lord told reporters Friday at the Pentagon.

Turkish pilots in the F-35 training program are currently based at Luke Air Force Base in Arizona and Eglin Air Force Base in Florida. Foreign Policy first reported details of the suspension on Friday.

Along with the suspension of Turkish fighter pilots from the F-35 training program, U.S. personnel working in joint production facilities will also return to the United States by the July 31 deadline, Mrs. Lord said. Turkey will also lose billions in F-35 funding, tied to manufacturing of the fighter’s spare parts, as a result of the Russian S-400 missile deal, she added.

Defense Department officials and their national security counterparts at the White House and State Department are negotiating what actions to take for the four F-35 aircraft already in the Turkish air force. The planes are currently being housed at Luke Air Force Base.

Mr. Shanahan’s decision to take action against Turkey’s participation in the F-35 program is the latest in a series of moves by the U.S. to slowly curtail Turkey’s involvement in the F-35 program, as Ankara presses ahead with the controversial purchase of the Russian S-400 missile.

But it was news of Ankara’s decision to begin sending Turkish troops to Russia, to train on the S-400 system that ultimately prompted the department to take its most recent action, Andrew Winternitz, acting deputy assistant secretary of defense for Europe and NATO, said during the same briefing on Friday.

“We wanted to be very clear what our position is here,” he said, noting the S-400 training in Russia “was a clear signal we needed to take action.”

The Pentagon already canceled all current and future transfers of critical equipment related to the export of the F-35 Joint Strike Fighter to Turkey in April, in protest of the S-400 deal with Moscow. U.S. and NATO officials fear the mixing of the Russian missile system and the American-made F-35 could give Moscow critical intelligence on the new jet’s capabilities and features.

Turkish President Recep Tayyip Erdogan and Mr. Akar have been adamant on Ankara’s goal of fielding the S-400 missile system, in lieu of the American-made Patriot missile — and stated their willingness to leave the F-35 program.

Turkish defense officials announced plans to consider adding Russian-made advanced fighter jets into their arsenal, should the U.S. ultimately scrap planned sales of the F-35.

While a series of “technological, economical and political deliberations” would have to take place among senior Turkish military brass before such a move could take place, Russian-made alternatives to the F-35 would be at the top of Ankara’s list of potential replacements, officials say.

But Mr. Winternitz said Friday ongoing dialogue between U.S. and Turkish officials could provide a solution to keep Ankara in the F-35 program.

“There is a desire to find a way forward,” he said, noting that Mr. Akar and Mr. Shanahan and their staff have been routinely engaged in talks on the S-400 issue for months.

“We hope this is an aberration” in the long-standing relationship between the two NATO allies, Mr. Winternitz said. “This is Turkey’s choice [and] we will adapt.”

For her part, Mrs. Lord made clear that Friday’s actions by the Pentagon were only temporary, pending Turkey’s abandonment of the Russian-made missile.

“None of the steps we are taking are irreversible,” she said.

Moreover, Mr. Winternitz said the U.S. “is willing to partner with Turkey immediately” to discuss other regional security issues outside the F-35 program, should Ankara decide to withdraw from the S-400. Those talks will include “current counterterrorism operations” against Kurdish People’s Protection Units, or YPG.

The YPG is the armed faction of the Kurdistan Workers Party or PKK, which Turkey has labeled as a terrorist organization. The YPG is also a key U.S. ally in the fight against the Islamic State and other extremist groups in the region.