DOHA, Qatar (AP) — The leader of the United Arab Emirates made a surprise visit on Monday to Qatar as it is hosting the World Cup — his first since leading a yearslong four-nation boycott of Doha over a political dispute that poisoned regional relations.

Sheikh Mohammed bin Zayed Al Nahyan, who also serves as the ruler of Abu Dhabi, made the trip at the invitation of Qatar's ruling emir, Sheikh Tamim bin Hamad Al Thani, the state-run WAM news agency reported.

“The visit builds on the existing brotherly relations between the two nations and their people,” WAM said in its brief report.

Sheikh Mohammed was widely viewed by analysts as one of the main architects of the boycott of Qatar by Bahrain, Egypt, Saudi Arabia and the United Arab Emirates that began in 2017.

At the height of the Qatar crisis, newspaper columns even suggested digging a trench along the 87-kilometer (54-mile) border with Saudi Arabia and filling it with nuclear waste. While rhetorical bluster, it showed how deeply the anger ran in the region amid the dispute — which Kuwait’s then-ruler suggested nearly sparked a war.

The anger was rooted in Qatar’s stance in supporting Islamists who rose to power in Egypt and elsewhere following the 2011 Arab Spring. While Qatar viewed their arrival as a sea change in the gerontocracies gripping the Mideast, other Gulf Arab nations saw the protests as a threat to their autocratic and hereditary rule.

During the 2011 protests, Saudi Arabia and the UAE sent troops to help a violent crackdown on demonstrations in Bahrain.

The boycott, during which the four nations shut off air and sea routes to Qatar, only ended in January 2021 just ahead of President Joe Biden taking office in the United States. The boycott began immediately after a visit to the region by then-President Donald Trump early in his presidency.

The opening ceremony of the World Cup, which coincided with Qatar facing Ecuador in the tournament's first match, was attended by Saudi Crown Prince Mohammed bin Salman and Egyptian President Abdel Fattah el-Sissi. Also on the dais with leaders was Turkish President Recep Tayyip Erdogan, who provided a vital lifeline to Qatar during the crisis.

Dubai's ruler also attended along with his son, while Sheikh Mohammed did not attend. However, he called Sheikh Tamim the following day and “congratulated” Qatar on hosting the World Cup — something that would have been unthinkable at the height of the diplomatic crisis.