Ismail Haniyeh, political leader of Hamas, was assassinated in July in Tehran. The location of the assassination was notable, because Haniyeh had spent most of his time in Doha, Qatar, since 2017. Most observers concur that Israel was behind the assassination, though it has neither confirmed nor denied doing so, and it’s reasonable to think that the choice of place came from a calculation that angering Qatar would be more problematic than angering Iran.
That decision reflects the importance that Qatar has taken on in the Middle East despite its small size. Iran has far superior military forces and funds Hezbollah, which the U.S. has designated a terrorist organization, on Israel’s Northern Border. Yet, the Israelis would have correctly recognized that their main ally, the U.S., sees the Qataris as pivotal to bringing peace to the region and mediating the conflict between Israel and Hamas.
Qatar’s role in brokering the talks marks the culmination of three decades of maneuvering by its leadership to position the emirate as a place where even enemies might meet. It has managed to become a major U.S. ally, even as it also maintains contact with, and hosts on its soil, American enemies like the Taliban, Hamas, and Iran.
For the first decades after its independence in 1971, Qatar was a minor player on the international relations scene, even allowing some foreign affairs to be conducted by its powerful neighbor, Saudi Arabia.
That changed on June 27, 1995, when Sheikh Hamad bin Khalifa came to power as emir of Qatar, with the support of the U.S. The new leader immediately launched a project to make his small Gulf state a new player, not simply in the region’s economy, but also in world affairs and in the realm of ideas and cultural influence. For instance, one of his first actions was to fund the Al-Jazeera Arabic satellite television station, allowing Qatar to set the agenda on TV screens from Casablanca to Cairo, usurping the role once played by state information ministries.
Hamad also encouraged his government to invest in new technologies such as Liquified Natural Gas (LNG). The emirate’s gas fields were a game changer because they dramatically enhanced Qatar’s wealth, providing hundreds of billions of dollars that he could export to gain influence as other countries became dependent on Qatari largesse. The emirate’s steady supply of energy also helped keep voters in western Europe happy during the cold winter months, earning the gratitude of the leaders of their countries.
Read More: This Is the Reality of Life for LGBTQ+ People in Qatar
By 1996, Qatar was delivering major shipments of natural gas to energy-hungry Japan and Europe, and accordingly gaining influence. Soon, the amount of LNG coming out of Qatar exceeded the wildest dreams of Hamad and his ministers. This was possible in part because Hamad built and maintained peaceful relations with Iran, which enabled Qatar to share the North Field where most of its gas got pumped.
In addition to becoming an indispensable source for world energy, Qatar also began inviting international universities to build campuses in the emirate. Sheikha Moza bint Nasser, the wife of the Emir Hamad inaugurated “Education City” in 1997. With prestigious institutions from Georgetown to Carnegie Mellon setting up campuses, Qatar has been able to project an image as the center for higher learning in the Middle East, usurping a position once held by far more populous countries such as Egypt and Lebanon.
Further, after 9/11, Qatar stepped up when the U.S. was looking for alternatives to Saudi bases. In 2003, the emirate agreed to allow the U.S. to turn Al-Udeid airbase, then largely a secret installation, into the sprawling headquarters of U.S. Central Command.
Yet, even as Qatar courted and built ties with the West, the emirate also hosted leaders in the Islamic world, including Yusuf al-Qaradawi, a Muslim Brotherhood leader who became a religious personality on Al Jazeera. This popular outreach to the Muslim world gave Qatar the latitude to maintain a quiet strategic and military alliance with the U.S. — which insured the small state against threats by more powerful neighbors — without becoming a pariah or losing public support in its own region.
Qatar’s biggest means of become a world player, however, was to become the host for peace talks among the region’s warring factions. Hamad and his advisers recognized that this role promised prestige at little cost.
Qatar cared less about which side in a dispute or war was a closer ally, and more about hosting the conversation to curry favor with both sides. In 2008, a political crisis in Lebanon was about to break into civil war. The Iran-backed Shia militia Hezbollah took control over parts of Beirut, as its rivals worked to eject Hezbollah officials from the government. Qatar offered to mediate — a daunting challenge given that Lebanon’s last bloody civil war had lasted for 15 years between 1975-1990. In 2009, however, Qatari mediators brokered an agreement, which allowed Hezbollah some role in government.
The emirate came out of the crisis looking like an impartial mediator, which garnered praise both from the U.S. — which staunchly opposes Hezbollah and other Iran-backed groups — and Iran, which is Hezbollah’s main patron.
Read More: The Diplomatic Off-Ramp After Israel’s Invasion of Gaza
Yet, Qatar never positioned itself as completely neutral in every conflict. It has long supported the Palestinian people with millions of dollars and supported Palestinian control over Gaza. In 2012, Hamad made the extraordinary gesture of visiting Gaza, while providing funds to ensure the infrastructure and government services of the strip would not completely shut down.
While some have criticized Qatar for supporting Hamas in these efforts, the emirate typically operated with the full knowledge — and even support — of the U.S. and Israel. Neither country wanted chaos in Gaza, but neither could afford politically to directly support Hamas. Qatar, once again, served as the useful middleman.
In 2013, Hamad retired to an advisory capacity. His son Sheikh Tamim succeeded him, and they continued to position Qatar as an indispensable mediator and peacemaker maintaining ties with all of the key players in the region.
Even as Qatar remained a major American ally, it managed to maintain a cordial relationship with Iran — much closer than any other top U.S. ally. That proved crucial in 2017 when Qatar encountered diplomatic troubles of its own.
Saudi Arabia, Bahrain, and the United Arab Emirates — with support from the Trump Administration — wanted to convince Qatar to curtail its outreach to Iran and support of groups like Hamas and the Muslim Brotherhood. Saudi Arabia shut its border to Qatar, imperiling the emirate’s food supply. Iran responded by sending planeloads of food and allowing Qatar airways to fly over its land.
In 2021, Qatar reached an agreement to prevent a war with Saudi Arabia, Bahrain, and the UAE. It conceded little — the emirate continued to host Hamas and support the Muslim Brotherhood — enabling it to maintain its position as a bridge between Iran and its rivals. Reflecting Qatar’s ability to straddle divides, Israel even signed a minor trading agreement with the emirate that same year.
The following year, the success of the World Cup in Doha helped smooth relations between Qatar and the other Gulf nations. And again, it allowed Qatar to re-emerge in its role as regional mediator.
When the Israel-Hamas War broke out in 2023, the U.S. called upon the emirate to help secure a ceasefire. Despite being separated by hundreds of miles from both Gaza and Israel, Doha, Qatar is the closest neutral space for the representatives of both Hamas leader Yahya Sinwar and Israeli Prime Minister Benjamin Netanyahu. While neither side wants to be seen as giving up ground, there is hope that Qatar can broker an agreement.
If history is any indication, it just might work. Negotiating an agreement would earn Qatar major credit around the globe and it would also at least temporarily solve the emirate’s most significant challenge.
Qatar needs to prevent any full-scale military conflict between the U.S. and Iran that might make the U.S. base in Qatar a target. Such a conflict would cut off the emirate’s main source of wealth and influence: the export of LNG through the Persian Gulf and Strait of Hormuz. A mistake and an escalation — whether it be an Iranian or Israeli overreaction — that leads to war between the U.S./Israel and Iran/Hezbollah, is possible every day a ceasefire is not signed. This feared doomsday scenario, more than anything else, motivates Qatar to try to find a solution before the peacemaker is drawn into a war and forced to choose sides.
Allen Fromherz is director of Middle East Studies Center at GSU and author of The Center of the World: A Global History of the Persian Gulf from the Stone Age to the Present (UC Press).
Made by History takes readers beyond the headlines with articles written and edited by professional historians. Learn more about Made by History at TIME here. Opinions expressed do not necessarily reflect the views of TIME editors.