WASHINGTON — President Obama believes that Saudi Arabia, one of America’s most important allies in the Middle East, needs to learn how to “share” the region with its archenemy, Iran, and that both countries are guilty of fueling proxy wars in Syria, Iraq and Yemen.

In a series of interviews with The Atlantic magazine published Thursday, Mr. Obama said a number of American allies in the Persian Gulf — as well as in Europe — were “free riders,” eager to drag the United States into grinding sectarian conflicts that sometimes had little to do with American interests. He showed little sympathy for the Saudis, who have been threatened by the nuclear deal Mr. Obama reached with Iran.

The Saudis, Mr. Obama told Jeffrey Goldberg, the magazine’s national correspondent, “need to find an effective way to share the neighborhood and institute some sort of cold peace.” Reflexively backing them against Iran, the president said, “would mean that we have to start coming in and using our military power to settle scores. And that would be in the interest neither of the United States nor of the Middle East.”

Mr. Obama’s frustration with much of the Arab world is not new, but rarely has he been so blunt about it. He placed his comments in the context of his broader struggle to extract the United States from the bloody morass of the Middle East so that the nation can focus on more promising, faster-growing parts of the world, like Asia and Latin America.