Every Russian schoolchild is taught about the violent death of Aleksandr Griboyedov in 1829. A poet and playwright whose work is enshrined in the country’s literary canon, Griboyedov had the misfortune to be Czar Nicholas I’s ambassador to Tehran in the wake of Persia’s humiliating loss of territory to Moscow’s spreading empire. A Tehran mob, furious at the czar and his infidel representatives, stormed the embassy, slaughtering the unlucky ambassador and 36 other Russian diplomatic staff.

A century and a half later, in 1979, those events were almost replayed in Iran (as Persia is now known). When five leaders of the Iranian revolutionary students gathered in Tehran to decide which foreign embassy to target, two of them advocated seizing the Soviet legation. They were persuaded instead to overrun the U.S. embassy, creating a no less historic trauma for another world power entangled in the politics of the Middle East.

Russia’s long history of involvement—and warfare—in the region is largely unknown to Westerners, but it helps to explain President Vladimir Putin’s decision last fall to intervene in Syria’s civil war. Mr. Putin’s gambit on behalf of the Syrian dictator Bashar al-Assad caught many in the West by surprise. Critics have assailed it as a miscalculated bid to replace the U.S. as the dominant outside power in the region.

But when viewed from Moscow, Mr. Putin’s Middle Eastern adventure looks like something very different: an overdue return to geopolitical aspirations that stretch back not only to the Soviet era but to centuries of czarist rule. “The Middle East is a way to showcase that the period of Russia’s absence from the international scene as a first-rate state has ended,” said Fyodor Lukyanov, the head of the Council on Foreign and Defense Policy in Moscow, which advises the Kremlin and other government institutions.

In Syria, Mr. Putin has achieved notable results. Russia has prevented the collapse of the Assad regime, which seemed imminent just a year ago. It also has positioned itself at the center of the Middle East’s diplomatic maneuvering, challenging the formerly unrivaled influence of the U.S. in the region.

“Russia sent a message to the Middle East with its direct intervention in Syria: We are more serious in settling the region’s problems than the Americans are,” said Salim al-Jabouri, the speaker of the Iraqi parliament and the country’s leading Sunni politician.

But today’s Russia can no longer dictate outcomes in the Middle East, as it once did in 19th-century Persia. Mr. Putin’s Syria campaign is limited by design and necessity—a modest investment by a power that can only afford to invest modestly. It is an attempt to become relevant again in a region that, historically, Russia has seen as its strategic backyard.

Russia has been in contact with the Muslim world, often unhappily, for more than a millennium. In the seventh century—long before the emergence of the Slavic principalities that would eventually form the Russian state—Arab armies of the early caliphate brought Islam to Derbent, the oldest city in today’s Russian Federation.

Ibn Fadlan, a 10th-century Arab diplomat and traveler, described meeting early Russians while visiting Muslim towns along the Volga River. He was struck by their “perfect bodies,” their poor hygiene and their practice of burning slave girls in the ship-borne funeral pyres of dead noblemen. Ibn Battuta, a 14th-century Arab globe-trotter, was less impressed: He wrote off the Russians as “an ugly and perfidious people with red hair and blue eyes.” At the time, the prince of Muscovy was a vassal of the Muslim khan of the Golden Horde, and Moscow’s coinage bore Arabic script.

Only in 1480 did Muscovy become fully independent and stop paying tribute to its Muslim overlords. A few decades later, Czar Ivan the Terrible began a series of wars that destroyed the vast Muslim khanates in Kazan, Astrakhan and Siberia, pushing Russia’s boundaries far to the south and east.

In the following centuries, Russia fought more than a dozen wars against the receding Ottoman Empire and steadily advanced into Persian-held lands. In the “Great Game” of the 19th century, Russia punched further south toward British India, gobbling up one Central Asian principality after another and almost coming to blows with the British over Afghanistan.

Moscow also positioned itself as the protector of the Middle East’s Christians—many of whom, like the Russians, were Orthodox. (The current head of the Russian Orthodox Church, Patriarch Kirill, alluded to this history when he recently described Russia’s military campaign in Syria as a “holy war” and called Russian troops there “Christ-loving warriors.”)

When World War I erupted, Britain and France promised Russia that, once the Ottoman Empire was defeated, the ultimate prize of Constantinople—today’s Istanbul—would come under Russian rule. That promise went unfulfilled after the 1917 Bolshevik Revolution.

The Soviet Union, which retained most of the territories that had been conquered by the czars, also hungered for more influence in the Middle East. In 1941, working as partners during World War II, the Soviet Union and the U.K. occupied Iran and ousted its shah, ostensibly to prevent German activities there.

By the 1960s, Soviet weapons, pilots and military instructors were pouring into Arab client states, transforming the Middle East into an arena for Cold War competition. While the U.S. backed Arab monarchies and Israel, the Soviets sided with leftist regimes in Egypt, Syria, Iraq, Libya and South Yemen, which became the Arab world’s only Marxist state.

With Iran’s revolution in 1979 and the rise of political Islam, Moscow’s influence began to wane. Egypt, the most populous Arab state, signed a U.S.-brokered peace treaty with Israel, and Moscow presided over a textbook case of imperial overreach by invading Afghanistan—undermining its regional influence and speeding up the Soviet Union’s own demise.

After Saddam Hussein’s invasion of Kuwait in 1990, Mikhail Gorbachev went along with the U.S.-led war to expel Iraq from its conquered neighbor. As Moscow’s influence in the region hit its nadir, Washington’s involvement grew larger. In the following decade, Russia was too busy trying to prevent the breakup of its own rump post-Soviet state, bloodied by separatist uprisings in Chechnya and other Muslim regions.

Mr. Putin successfully pacified those borderlands and, at first, largely left unchallenged the Middle East’s Pax Americana. As recently as 2011, when the Arab Spring started blazing through the region, Moscow chose not to use its veto in the U.N. Security Council to block a resolution that paved the way for the U.S. and its allies to intervene militarily in Libya and oust dictator Moammar Gadhafi.

But Mr. Putin has repeatedly blocked any such action in Syria, where 400,000 people have been killed and more than half the population displaced since 2011, according to the United Nations. Moscow’s relationship with the Syrian regime goes back many decades—to the days of Hafez al-Assad, the current president’s father—and the country is also home to Russia’s only naval facility in the Mediterranean, at Tartus. While the U.S. has long stated that Mr. Assad must go, Washington has refrained from openly attacking his regime. Mr. Putin, by contrast, has deployed Russia’s latest weaponry against Mr. Assad’s opponents, including groups backed by Washington.

Few people in the Middle East—even Moscow’s beneficiaries—assign charitable motives to Russia’s new activism in the region. “The Russians are not doing it because they are part of the Red Cross. They are doing it because they have interests,” said Yassine Jaber, a Lebanese Shiite member of parliament and a former cabinet minister. “Now they’ve achieved their historical dream of having bases in the warm waters of the region, and they will make sure no gas pipelines will come from Central Asia or Qatar without their approval. They have gained a foothold in the region.”

Mr. Putin’s ambition to re-establish Russia as a major power in the Middle East (and the rest of the world) has been constrained by his country’s declining economy, now roughly the size of Italy’s and still shrinking. Already suffering from sanctions imposed by the West after Mr. Putin’s 2014 invasion of Ukraine, Russia has been hit hard by the low prices of oil and gas, the country’s main exports. But such limits are familiar to Russia, which has never been particularly prosperous but has frequently sought a leading role in global affairs.

“Putin understands that Russia, based on its economic weight today, can’t be a great power, but he refuses to act in accordance with this weight,” explained Dmitri Trenin, head of the Carnegie Center in Moscow and a former Soviet military officer whose career included a stint as an adviser in Iraq. “He aims to punch well above Russia’s economic might. The worldview is: We are either a great power, or we disintegrate and are nothing.”

Nor is it just a lackluster economy that limits the reach of Russian influence. Russia also lacks the kind of soft power that the U.S. has long exercised world-wide. Young Arabs and Iranians are not particularly eager to watch Russian movies, listen to Russian pop music or study in Russia.

“No one in this part of the world loves or hates Russia today. Russia in the Arab mind is just political strategy and weapons. These are its only commodities,” said the Lebanese writer and commentator Hazem Saghieh. “It can’t give much because it doesn’t have much.”

If anything, there is a stronger social and cultural influence spreading in the other direction. Today’s Russian population is about 15% Muslim—a proportion that has grown with the influx of millions of migrant workers from Central Asia. Russia is also, by some counts, the world’s second-largest source of recruits for Islamic State. From a city like Derbent, the distance to Baghdad is roughly the same as from Boston to Chicago.

“The Middle East is too close to us for Russia to be a mere observer,” said Andrey Kortunov, the head of the Russian International Affairs Council, a think tank affiliated with the Russian foreign ministry. “It’s not remote Australia or Argentina; it is a world that we see on the streets of our cities, behind the counters of our stores, among the workers of our construction sites and, yes, also inside our jails. All of this requires playing an active role.”

An active role does not mean, however, attempting to imitate the massive Middle East engagements of the U.S. over the past decade. “The American experience in Iraq is being studied with great attention,” said Mr. Lukyanov of the Council on Foreign and Defense Policy. “The lesson is that we can’t get involved too deeply—but we also can’t withdraw too quickly.”

Despite concern about maintaining limits on its involvement in Syria, Moscow may yet—as President Barack Obama publicly warned last year—get “stuck in a quagmire.” Russia also risks alienating the Muslim world’s majority Sunnis by siding with Mr. Assad, who is backed by Shiite Iran and Shiite militias in his war against mostly Sunni rebels. In a region increasingly split across sectarian lines, such alliances may make Russia more of a target for Islamic State and other Sunni Islamist terrorist groups.

Aware of that danger, Russia has avoided casting today’s Middle East as a zero-sum game or seeking to push the U.S. from the region. Despite occasional bombast, Moscow quietly welcomed Mr. Obama’s recent decision to extend the deployment of nearly 10,000 U.S. troops in Afghanistan, a move that could prevent the spread of Islamist militancy into former Soviet states in neighboring Central Asia.

Unlike the U.S.—or the former Soviet Union, whose Middle Eastern alliances were constrained by ideology—Mr. Putin’s Russia has the advantage of being on speaking terms with all of the region’s main powers. (The lone exception is Turkey, a bitter foe of the Assad regime that, to Mr. Putin’s fury, downed a Russian warplane in November.)

“While the American influence has receded, Moscow has built unique relationships in the Middle East. On one side, it has strategic ties with Israel, and on the other, no less important ties with Iran,” said Yelena Suponina, a Middle East expert at Russia’s Institute of Strategic Studies, a think tank affiliated with the Kremlin. Moscow also keeps up ties with Hamas and Hezbollah, which the West considers terrorist groups. “Not a single Western country can repeat what Russia is doing,” she added.

This readiness to deal with all sides has meant, however, that Russia finds itself with no bedrock allies in the region. Even as Russia has joined with Iran to save Mr. Assad’s regime, overall Iranian-Russian relations remain cool, and the two countries haven’t become major trade partners. The Iranians resent Moscow’s cooperation with Israel, and Russia does not want to get dragged into Iran’s sectarian conflict with Sunni powers led by Saudi Arabia.

“The Iranians feel they are constantly being duped [by the Russians]…and that they are not going to follow through with their promises,” said Dina Esfandiary, a fellow at King’s College London.

“There is no love for Iran in Russia, and for Russia in Iran. The beauty of this relationship is that it’s purely pragmatic,” agreed Mr. Trenin of the Carnegie Center. The only country in the Middle East with which a significant proportion of Russians empathize, he added, is Israel, in part because so many Israelis hail from the former Soviet Union and speak Russian. As it happens, of course, Israel is also the closest regional ally of the U.S.

The Russia-Israel connection is likely to grow even warmer with the return to government of the most prominent of the Soviet-born Israelis, Avigdor Lieberman, who became Israel’s defense minister this past week. Mr. Lieberman, an ultranationalist and a former foreign minister, has called the Russian-sponsored deal to remove Syria’s chemical weapons a major boon to Israeli security.

“My experience is that you can do business with [the Russians]. They are pragmatic, and you can close a deal and get a clear answer,” Mr. Lieberman said in an interview before taking his new post. “Russia is near by, and it will never renounce its interests in the Middle East. It is too big a power to be ignored.”