U.S. President Barack Obama speaks during a press conference with Canadian Prime Minister Justin Trudeau in the Rose Garden of the White House in Washington, DC, March 10, 2016. SAUL LOEB/AFP/Getty Images

Wars and chaos in the Middle East will not end until Saudi Arabia and Iran can find a way to "share the neighborhood" and make some kind of peace, U.S. President Barack Obama said in a magazine interview released on Thursday.

"The competition between the Saudis and the Iranians, which has helped to feed proxy wars and chaos in Syria and Iraq and Yemen, requires us to say to our friends, as well as to the Iranians, that they need to find an effective way to share the neighborhood and institute some sort of cold peace," Obama told The Atlantic.

In a wide ranging interview on foreign policy, Obama also put a share of the blame for the crisis in Libya on Washington's European allies. Libya is embroiled in political chaos after its 2011 uprising and facing a security vacuum and a growing threat from Islamic State.

"When I go back and I ask myself what went wrong, there's room for criticism, because I had more faith in the Europeans, given Libya's proximity, being invested in the follow-up," Obama said. The Obama administration withdrew U.S. troops from Iraq but has grappled with years of Middle East turmoil since the Arab Spring uprising. Obama, in his final year in the White House, said there were limits on how far the United States could police the region.

"You have countries that are failing to provide prosperity and opportunity for their people. You've got a violent, extremist ideology, or ideologies, that are turbocharged through social media," he said. "You've got countries that have very few civic traditions, so that as autocratic regimes start fraying, the only organizing principles are sectarian."

On Syria, now in its fifth year of civil war, Obama defended his decision not to launch strikes there in 2013, despite concerns over President Bashar al-Assad's use of chemical weapons. Critics have seen that as a missed opportunity that might have helped bring an end to the war.

"For me to push the pause button at that moment, I knew, would cost me politically," he said. "I believe ultimately it was the right decision to make."

He also discussed Russia, which has increased its role in the Middle East by staking out a role in Syria and infuriating Washington with its support of Assad, who the United States and other Western nations have said must leave power.

On Russian President Vladimir Putin, Obama said the two have "very businesslike" meetings, adding: "He understands that Russia's overall position in the world is significantly diminished."