Riyadh: Iran and Saudi Arabia have agreed to re-establish diplomatic relations and reopen embassies after talks in Beijing between officials from the two rival Middle East powers, Iranian state media reported on Friday.

"As a result of the talks, Iran and Saudi Arabia agreed to resume diplomatic relations and re-open embassies...within two months," Iranian news agency IRNA reported.

This major development comes after years of tensions between the two countries, including a devastating attack on the heart of the kingdom's oil production attributed to Tehran.

In a joint trilateral statement issued by China, Saudi Arabia and Iran, " With the initiative of Chinese President Xi Jinping of China's support for developing good neighbourly relations between the Kingdom of Saudi Arabia and the Islamic Republic of Iran."

The three countries announce that an agreement has been reached between Saudi Arabia and Iran, which includes an agreement to resume diplomatic relations between them and re-open their embassies and missions within a period not exceeding two months, and the agreement includes their affirmation of the respect for the sovereignty of states and the non-interference in internal affairs of states,"the statement issued by Saudi Arabia government said.

Based on the trilateral agreement whereby China would host and sponsor talks between the Kingdom of Saudi Arabia and the Islamic Republic of Iran, "Proceeding from their shared desire to resolve the disagreements between them through dialogue and diplomacy, and in light of their brotherly ties."

Adhering to the principles and objectives of Charters of the United Nations and the Organization of Islamic Cooperation (OIC), and International conventions and norms. The delegations from the two countries held talks during the period March 6-10, 2023 in Beijing - the delegation of the Kingdom of Saudi Arabia headed by His Excellency Dr. Musaad bin Mohammed Al-Aiban, Minister of State, Member of the Council of Ministers, and National Security Advisor, and the delegation of the Islamic Republic of Iran headed by His Excellency Admiral Ali Shamkhani, Secretary of the Supreme National Security Council of the Islamic Republic of Iran, the statement added.

"They also agreed that the ministers of foreign affairs of both countries shall meet to implement this, arrange for the return of their ambassadors, and discuss means of enhancing bilateral relations. They also agreed to implement the Security Cooperation Agreement between them, which was signed in 2001, and the General Agreement for Cooperation in the Fields of Economy, Trade, Investment, Technology, Science, Culture, Sports, and Youth, which was signed in 1998," it added.

The three countries expressed their keenness to exert all efforts towards enhancing regional and international peace and security

The Saudi and Iranian sides expressed their appreciation and gratitude to Iraq and Oman for hosting rounds of dialogue that took place between both sides during the years 2021-2022.

The two sides also expressed their appreciation and gratitude to the leadership and government of the People's Republic of China for hosting and sponsoring the talks, and the efforts it placed towards its success.

It is pertinent to mention that the ties between Saudi Arabia and Iran were snapped in 2016 after its embassy in Tehran was stormed during a dispute between the two countries over Riyadh's execution of a Shi'ite Muslim cleric.

Iran, the leading Shi'ite Muslim state in the Middle East, and Saudi Arabia, the region's oil-exporting giant and Sunni Muslim power, have backed opposite sides in proxy wars in Yemen, Syria and elsewhere.

Iranian media quoted what they described as a joint statement between Iran, Saudi Arabia and China as saying the two countries "emphasise respect for sovereignty and non-interference in each other's internal affairs".