Russia has steadily inserted itself into Iraqs military, energy, and educational sectors, and these relationships could turn Baghdad further away from the United States now that the Trump administration has ceded Syria to Moscow.

When President Trump announced the United States’ withdrawal from northeast Syria, he was abandoning the Kurdish forces that have fought at our side against ISIS to Turkey and setting the stage for the possible resurgence of an ISIS 2.0. Leaving aside the moral and humanitarian dimensions of the decision, subsequent developments have shown it to have been recklessly rash. It was a disaster that signaled to all our adversaries and allies that the world’s sole superpower is both profoundly unreliable and irresponsibly erratic. Perhaps worst of all, it was incoherent from the Trump Administration’s own strategic premises outlined in the 2017 National Security Strategy. Great power competition was supposed to be the order of the day, and yet the moves in Syria were clearly ceding ground to both Russia and Iran.

Lost in the general uproar is a consideration of the particular knock-on effects of Trump’s decision. Iraq serves as a good case study. Despite Trump’s talk of withdrawal from the Middle East as a whole, the U.S. remains engaged in that country for the immediate future. Indeed, a number of American troops will reportedly reposition from Syria into Iraq, with the U.S. likely to continue supporting counter-terrorism efforts in Baghdad. And though American commitment to the country—and more broadly to the Middle East—is ever more ambiguous for the long term given recent events, it’s worth examining the geopolitical stakes in Iraq, especially with regards to Russia, to understand more clearly how they are being jeopardized by Trump’s recent move.

There are soft and hard power components to Russia’s strategy in Iraq, and they have been having a measurable effect for some time now. The Kremlin is making deals and forging relationships in the country’s energy industry, security infrastructure, media landscape, and government. “We are very interested in increasing our trade, economic and investment ties,” said Russian Foreign Minister Sergei Lavrov in January 2019 when he hosted his Iraqi counterpart Mohamed Ali al-Hakim in Moscow. Iraqi Ambassador to Russia Haidar Mansour Hadi said Lavrov’s visit to Iraq shows not only interest in developing better relations with Iraq but also “in the settlement of the situation in the region.” During his most recent trip to Baghdad and Irbil this month, Lavrov said that Russia and Iraq have the same position on Syria.

Russia’s total investment in Iraq’s energy industry has exceeded $10 billion, a result of years of Kremlin efforts to return to Iraq after the 2003 war, when the new government in Baghdad cancelled many Saddam Hussein-era energy contracts with Russia. In February 2008, Moscow wrote off the bulk of Iraq’s Soviet-era $12.9 billion of debt in exchange for a $4 billion oil deal that included access to West Qurna-2, one of the world’s largest oil fields.

Lukoil and Gazprom Neft entered the Iraqi Kurdistan energy market in 2012 and subsequently won a number of contracts. Three years later, as American energy companies began to decrease their presence in part due to security concerns, the Kurdistan Regional government (KRG) invited more Russian firms. Russian energy giant Rosneft, sanctioned by the United States in 2014, signed oil contracts with both the Iraqi government and the KRG. Moscow also fronted the KRG a $3.5 billion loan, to be repaid to Rosneft with oil in the future. The payment threw the KRG a financial lifeline when it was struggling, and provided it with a degree of leverage vis-a-vis Baghdad, which wants control of the KRG oil sales but now has to deal with Rosneft on this issue. Moreover, Rosneft bought a majority stake in the KRG oil pipeline to Turkey and agreed to construct a parallel gas pipeline. For Moscow, energy is largely a foreign policy tool, and control of a pipeline holds long-term strategic implications not only for the KRG and Baghdad but also for Turkey.

In October 2013, Moscow began arms deliveries to Iraq as part of a $4.2 billion arms deal, revived after Iraq withdrew from it the year before due to corruption allegations. In early 2014, Washington delayed the delivery of F-16 fighter planes and Apache helicopters to Iraq in part because Congress stalled and in part because the lengthy bureaucratic process of the program could not be synchronized with the immediate situation on the ground. Iraqi Prime Minister Haider al-Abadi appealed to Putin, who quickly provided 12 fighter jets to Baghdad, and without any restrictions at that. The first batch of F-16s ultimately arrived in July 2015, and more followed over the years. More to the point, however, in early 2014 the Iraqis also needed U.S. airstrikes against ISIS, which the White House delayed until August of the same year. In my conversations in Baghdad last month, Iraqis still remember the speed with which Russian weaponry came at a time when they needed it the most. Moscow’s quick arms delivery helped shape a perception of Putin as someone who helped Iraq fight the Islamic State.

In October 2015, days after Moscow announced its Syria intervention, a new intelligence sharing center opened in Baghdad, staffed with Russian, Iranian, and Syrian personnel, with participation of Hezbollah, and aimed to provide intelligence for air strikes targeting ISIS fighters. In reality, the center achieved nothing in this regard but instead succeeded at establishing a legitimate reason for Moscow to maintain an intelligence presence in Iraq.

Moscow hardly appears as the dominant actor in Iraq but it cultivated a perception of someone that, unlike the U.S., doesn’t overpromise—and when it does promise something, that it delivers. Since December 2018, plans are on the way to reopen the Iraqi-Russian culture center in Baghdad, which Moscow closed in 2003. RT Arabic contributes to shaping a positive image of the Kremlin, and Iraqis perceive the outlet as a legitimate source of information. Among RT Arabic’s claims is that Russia consistently fought ISIS. Moscow also cultivates an image of a country that cares about human rights by repatriating children of Russian citizens who joined ISIS in Iraq and Syria. Meanwhile, the Iraqi government suspended the U.S.-funded Al-Hurra Iraq after it broadcast corruption allegations surrounding the clergy.

Moscow provides Iraqi university students with a small number of scholarships to study in Russia, and Lavrov observed that “dozens of diplomats from Iraq take part in special training courses at the Diplomatic Academy at the Russian Foreign Ministry.” Iraqi Higher Education Minister Qusay Al-Suhail signed a memorandum of understanding in September to increase Russian scholarships to Iraqis and to expand cooperation more broadly. Overall, Iraqis tend to prefer to study in the West, but high costs and bureaucratic hurdles often get in the way. Moreover, many senior Iraqi officers in the military who had experience in pre-2003 Iraq had Soviet training, unlike the younger generation that has primarily worked with the United States.

Moscow faces competition in Iraq from Iran, but the Russians tend to try to cooperate with Iran rather than working at cross-purposes. Anti-Americanism and a joint opposition to American influence in the Middle East has united the two countries for years, but the two countries haven’t been quite this aligned for centuries, with the war in Syria, in particular, lifting the partnership to unprecedented heights.

Baghdad is also expanding outreach to China as part of a broader effort to finance reconstruction. And as Beijing’s appetite for energy continues to grow, it will increasingly set its sights on the Middle East. As far as top-line figures, Russia’s $1.7 billion in bilateral trade with Iraq is dwarfed by the $30 billion of business Baghdad does with Beijing. Still, when it comes to security and energy development, Iraq turns to Moscow rather than Beijing.

For many Americans, there is a profound sense of Iraq fatigue. What most don’t recognize is that despite the country’s troubles, some hard-won freedoms have taken hold since the fall of Saddam, a brutal dictator who openly admired Joseph Stalin. Iraq faces many daunting challenges, but Iraqis are unafraid to ask their government tough questions in public forums, something I witnessed firsthand on my recent trip. It is difficult to find this anywhere in the broader Middle East, other than in Israel and perhaps Tunisia. In another positive development, polls show that sectarianism in Iraq has declined in recent years, with more and more citizens identifying themselves as Iraqi first.

President Trump’s announced withdrawal inflicts enormous damage on American credibility in the broader Middle East, but the United States still can—and should—engage in Iraq. It should do so not only to ensure security and counter Iranian influence (which still supposedly matters to the White House), but also that of Russia, one of the rising competitors identified in the National Security Strategy.

The lift will not be easy, but if the United States continues to de-prioritize Iraq, it will surely be lost to the rising authoritarian tide sweeping the region. And above all, we should remember the truism that what happens in the Middle East rarely stays in the Middle East.