North Korea has diplomatic relations with 160 states. In the past, the country's foreign relations were marked by its conflict with South Korea and its historical ties to the Soviet Union. Both the government of North Korea and the government of South Korea claim to be the sole legitimate government of the whole of Korea. The de facto end of the Korean War left North Korea in a military confrontation with South Korea along the Korean Demilitarized Zone.

At the start of the Cold War, North Korea had diplomatic recognition only by communist countries. Over the following decades, it established relations with developing countries and joined the Non-Aligned Movement. When the Eastern Bloc collapsed in the years 1989–1992, North Korea made efforts to improve its diplomatic relations with developed capitalist countries. At the same time, there were international efforts to resolve the confrontation on the Korean peninsula. At the same time, North Korea acquired nuclear weapons, adding to the concerns of the international community.

Principles and practice The Constitution of North Korea establishes the country's foreign policy. While Article 2 of the constitution describes the country as a "revolutionary state", Article 9 says that the country will work to achieve Korean reunification, maintain state sovereignty and political independence, and "national unity".United Nations, "North Korean Constitution ", April 2009.Naenara, "Socialist Constitution of the Democratic People's Republic of Korea", Pyongyang, Korea, Juche 103 (2014).

Many articles specifically outline the country's foreign policy. Article 15 says that the country will "protect the democratic national rights of Korean compatriots overseas and their legitimate rights and interests as recognized by international law" and Article 17 explicates the basic ideals of the country's foreign policy: Basic ideals of their foreign policy are "independence, peace and friendship" Establishment of political, economic, cultural, and diplomatic relations with "friendly countries" on the principles of "complete equality, independence, mutual respect, non-interference in each other's affairs and mutual benefit." Unifying with "peoples of the world who defend their independence" Actively supporting and encouraging "struggle of all people who oppose all forms of aggression and interference and fight for their countries' independence and national and class emancipation."

Other parts of the constitution explicate other foreign policies. Article 36 says that foreign trade by the DPRK will be conducted "by state organs, enterprises, and social, cooperative organizations" while the country will "develop foreign trade on the principles of complete equality and mutual benefit." Article 37 adds that the country will encourage "institutions, enterprises and organizations in the country to conduct equity or contractual joint ventures with foreign corporations and individuals, and to establish and operate enterprises of various kinds in special economic zones." Furthermore, Article 38 says that the DPRK will implement a protectionist tariff policy "to protect the independent national economy" while Article 59 says the country's armed forces will "carry out the military-first revolutionary line." In terms of other foreign policy, Article 80 says that the country will grant asylum to foreign nationals who have been persecuted "for struggling for peace and democracy, national independence and socialism or for the freedom of scientific and cultural pursuits."

Ultimately, however, as explicated in Articles 100–103 and 109, the chairman of the National Defense Commission (NDC) is the supreme leader of the country, with a term that is the same as members of the Supreme People's Assembly or SPA (five years), as is established in article 90, directing the country's armed forces, and guiding overall state affairs, but is not determined by him alone since he is still accountable to the SPA. Rather, the NDC chairman works to defend the state from external actors. Currently, Kim Jong Un is the leader of the Workers' Party of Korea (WPK), head of state, and supreme commander. The Constitution also delineates, in article 117, that the Chairman of the Standing Committee of the Supreme People's Assembly, which can convene the SPA, receives "credentials and letters of recall from envoys accredited by other countries." Additionally, the cabinet of the DPRK has the authority to "conclude treaties with foreign countries and conduct external affairs" as noted in Article 125.

North Korea is one of the few countries in which the giving of presents still plays a significant role in diplomatic protocol, with Korean Central News Agency (KCNA) reporting from time to time the country's leader received a floral basket or other gift from a foreign leader or organization.Sometimes, the announcements never mention what sort of gift, but the Kim family has a large collection of cultural and other souvenirs from leaders all over the world, which is partly or entirely on public display. During a 2000 visit to Pyongyang, US Secretary of State Madeleine Albright gave North Korean leader Kim Jong Il a basketball signed by Michael Jordan, as he took an interest in NBA basketball. During the 2000 inter-Korean summit, Kim Jong Il made a gift of two Pungsan dogs (associated with the North) to South Korean president Kim Dae-jung. In return, Kim Dae-jung gave two Jindo dogs (associated with the South) to Kim Jong Il.Wei Du, "Inter-Korean summit: What gifts will Moon Jae-in, Kim Jong Un bring for each other?" , Channel News Asia (April 26, 2018). At their Pyongyang summit in 2018, North Korean leader Kim Jong Un gave two Pungsan dogs to South Korean President, Moon Jae-in.

North Korea takes its defense seriously, confronting countries they see as threatening their sovereignty, and restricts the activities of foreign diplomats.

History

After 1945, the USSR supplied the economic and military aid that enabled North Korea to mount its invasion of South Korea in 1950. Soviet aid and influence continued at a high level during the Korean War. This was only the beginning of North Korea as governed by the faction which had its roots in an anti-Japanese Korean nationalist movement based in Manchuria and China, with Kim Il Sung participating in this movement and later forming the Workers' Party of Korea (WPK).

The assistance of Chinese troops, after 1950, during the war and their presence in the country until 1958 gave China some degree of influence in North Korea.

In 1961, North Korea concluded formal mutual security treaties with the Soviet Union and China, which have not been formally ended. In the case of China, Kim Il Sung and Zhou Enlai signed the Sino-North Korean Mutual Aid and Cooperation Friendship Treaty, whereby Communist China pledged to immediately render military and other assistance by all means to its ally against any outside attack.Treaty of Friendship, Co-operation and Mutual Assistance between the People's Republic of China and the Democratic People's Republic of Korea , July 11, 1967. The treaty says, in short that:

The Chairman of the People's Republic of China and the Presidium of the Supreme People's Assembly of the Democratic People's Republic of Korea, determined, in accordance with Marxism–Leninism and the principle of proletarian internationalism and on the basis of mutual respect for state sovereignty and territorial integrity, mutual non-aggression, non-interference in each other's internal affairs, equality and mutual benefit, and mutual assistance and support, to make every effort to further strengthen and develop the fraternal relations of friendship, co-operation and mutual assistance between the People's Republic of China and the Democratic People's Republic of Korea, to jointly guard the security of the two peoples, and to safeguard and consolidate the peace of Asia and the world ... [Article II:]The Contracting Parties will continue to make every effort to safeguard the peace of Asia and the world and the security of all peoples ... [Article II:] In the event of one of the Contracting Parties being subjected to the armed attack by any state or several states jointly and thus being involved in a state of war, the other Contracting Party shall immediately render military and other assistance by all means at its disposal ... [Article V:] The Contracting Parties, on the principles of mutual respect for sovereignty, non-interference in each other's internal affairs, equality and mutual benefit and in the spirit of friendly co-operation, will continue to render each other every possible economic and technical aid in the cause of socialist construction of the two countries and will continue to consolidate and develop economic, cultural, and scientific and technical co-operation between the two countries ... [Article VI:] The Contracting Parties hold that the unification of Korea must be realized along peaceful and democratic lines and that such a solution accords exactly with the national interests of the Korean people and the aim of preserving peace in the Far East.

For most of the Cold War, North Korea avoided taking sides in the Sino-Soviet split. It was originally only recognized by countries in the Communist Bloc until 1962 when, upon becoming independent, Algeria recognized it. The provisional government set up by Algerian independence fighters had made a resolution to recognize North Korea.

East Germany was an important source of economic cooperation for North Korea. The East German leader, Erich Honecker, who visited in 1977, was one of Kim Il Sung's closest foreign friends. In 1986, the two countries signed an agreement on military co-operation. Kim was also close to maverick Communist leaders, Josip Broz Tito of Yugoslavia, and Nicolae Ceaușescu of Romania. North Korea began to play a part in the global radical movement, forging ties with such diverse groups as the Black Panther Party of the US, the Workers' Party of Ireland, and the African National Congress. As it increasingly emphasized its independence, North Korea began to promote the doctrine of Juche ("self-reliance") as an alternative to orthodox Marxism-Leninism and as a model for developing countries to follow.

When North-South dialogue started in 1972, North Korea began to receive diplomatic recognition from countries outside the Communist bloc. Within four years, North Korea was recognized by 93 countries, on par with South Korea's 96. North Korea gained entry into the World Health Organization and, as a result, sent its first permanent observer missions to the United Nations (UN). In 1975, it joined the Non-Aligned Movement.

Libyan Leader Muammar Gaddafi met with Kim Il Sung and was a close ally of the DPRK.

In 1983, North Korea carried out the Rangoon bombing, a failed assassination attempt against South Korean dictator Chun Doo-hwan while he was visiting Burma. This attack on neutral soil led many Third World countries to reconsider their ties with North Korea. During the 1980s, the pace of North Korea's establishment of new diplomatic relations slowed considerably.Barry K. Gills, Korea versus Korea: A Case of Contested Legitimacy (Routledge, 1996), p. 198."A Bomb Wreaks Havoc in Rangoon". Time. October 17, 1983. Following Kim Il Sung's 1984 visit to Moscow, there was a dramatic improvement in Soviet-DPRK relations, resulting in renewed deliveries of advanced Soviet weaponry to North Korea and increases in economic aid. In 1989, as a response to the 1988 Seoul Olympics, North Korea hosted the 13th World Festival of Youth and Students in Pyongyang.