F OR THREE years President Donald Trump’s foreign policy has seesawed between threats to bomb enemies and moon-shot diplomacy. The president has flirted with nuclear war with North Korea, only to become the first sitting president to step onto its soil. He has strangled Iran’s economy and ordered bombers into the air, then offered talks. A troop surge in Afghanistan gave way to a proposed summit with the Taliban.

John Bolton’s appointment as national security adviser in April 2018 seemed to tilt the scales towards the hawks. His acrimonious departure on September 10th—fired by presidential tweet—suggests that Mr Trump is now in a dealmaking mood, ahead of next year’s election. That is likely to have consequences for America’s relations with enemies and allies alike.

In recent months Mr Bolton has clashed with the president on many fronts. Mr Trump grew impatient with his adviser’s dogged opposition to making concessions during negotiations with Kim Jong Un of North Korea and his fixation with sanctions on Iran. Nicolás Maduro’s hold on power in Venezuela also proved more durable than Mr Bolton advertised.

Mr Trump sees economic and military muscle-flexing as part of a bargaining process in which foes (he hopes) morph quickly into interlocutors; Mr Bolton would settle for nothing less than their surrender. He forcefully opposed Mr Trump’s proposal to ease sanctions against Iran in order to secure a meeting with Hassan Rouhani, Iran’s president. But the last straw appears to have been Mr Bolton’s dissent over Mr Trump’s invitation (later rescinded) to the Taliban to sign a peace agreement at Camp David, the presidential retreat.

Hunting for deals

Mr Bolton’s influence should not be overstated. He was more irritant than obstacle. He could not prevent Mr Trump from pulling troops out of Syria, pursuing talks with the Taliban and charming Mr Kim. Even so, his departure is a statement of presidential intent. Though Mr Trump considers himself a master tactician and accomplished dealmaker, he has yet to secure a big diplomatic deal after three years in office. Meanwhile, Mr Maduro remains firmly in power, while arms control with Russia is collapsing. North Korea continues to churn out bomb fuel and Iran’s nuclear programme is expanding once more. Violence against civilians in Afghanistan stands at near-record levels.

Mr Trump, eager for a first-term legacy, is therefore likely to renew his pursuit of grand bargains, probably punctuated by set pieces like the trio of encounters with Mr Kim. Iran looks to be first on the list. Mike Pompeo, the secretary of state—a hardliner himself, who nevertheless feuded with Mr Bolton—hinted on September 10th that Mr Trump could meet Mr Rouhani with “no preconditions” during the UN General Assembly, which begins on September 17th. That would be the first meeting between American and Iranian leaders since Iran’s Islamic revolution in 1979, and a route to easing six months of growing tensions.

Although Mr Trump said that talks with the Taliban were “dead”, they may well be resuscitated. It is hard to know why they collapsed. Perhaps because the president saw a deficiency in the agreement, or because of insurgent violence—which has killed thousands of Afghans since talks began—perhaps because an American soldier was killed at an inopportune moment or because of the poor optics of hosting the Taliban at Camp David the weekend before September 11th.

The biggest prize of all would be Russia, whose covert intervention in America’s 2016 election was intended to help nudge Mr Trump into office. In August, Mr Trump unnerved several allies at the G 7 summit in France by reiterating his demand that Russia be readmitted to the club. The president will be encouraged by a thaw in the Ukraine crisis, following the exchange of 70 prisoners between Russia and Ukraine on September 9th, and recent efforts by Emmanuel Macron, France’s president, to repair Europe’s own frayed ties with Russia.

Here, Mr Trump might see arms control as an opportunity. Mr Bolton, a veteran saboteur of nuclear diplomacy, urged the president to quit the Intermediate-Range Nuclear Forces ( INF ) treaty and played down the prospects that New START , the linchpin of arms control between America and Russia, would be renewed in 2021. Though the INF treaty died on August 2nd, New START now looks a little likelier to limp on.

Mr Bolton’s departure leaves Mr Pompeo as the administration’s dominant foreign-policy voice. He lacks Mr Bolton’s familiarity with the federal bureaucracy, but he has a skill vital for survival in this administration: a willingness to accommodate Mr Trump’s views, shaping them if necessary, rather than blocking or sabotaging their implementation. Mr Pompeo also possesses an ability to turn the president’s gut instincts into policy.

Mr Trump says he will name Mr Bolton’s replacement—the fourth national security adviser in three years, a record—within days. Several names have been floated, each typifying a different approach. Mr Trump could choose a veteran bureaucrat such as Brian Hook, the State Department’s point man on Iran. If he wants someone skilled at selling his policy on Fox News, he might choose Richard Grenell, America’s undiplomatic ambassador to Germany. Or he may opt for military expertise, in which case the prize might go to Keith Kellogg, a national security adviser to the vice-president who filled in after Mike Flynn left the administration.

Whoever takes over, their most urgent task will be to reinvigorate the national-security bureaucracy that Mr Bolton—who has long held dim views of bureaucrats who are not John Bolton—sidelined, to give himself and his views maximum influence with the president. That process is deliberately unwieldy, but it provides the president with the range of perspectives to inform his decisions and the structure to enforce them. If Mr Trump is to have any hope of striking advantageous deals with his adversaries, he will need a functional policymaking apparatus.

Unfortunately, that apparatus cannot save Mr Trump from himself. No matter how proficient his adviser, Mr Trump will still make foreign policy on the fly, tweet by tweet. Worse, his obvious thirst for a legacy-defining deal puts Iran, North Korea and Russia at an advantage. ■