BEIJING (Reuters) - China hopes all parties on the Korean peninsula will remain calm and exercise restraint, President Xi Jinping told a senior visiting North Korean envoy on Wednesday, after the isolated state rattled nerves with a failed missile test.

China's President Xi Jinping arrives for a welcoming ceremony for Togo's President Faure Gnassingbe (not in picture) outside the Great Hall of the People in Beijing, China, May 30, 2016. REUTERS/Jason Lee

The rare meeting in Beijing between Xi and one of North Korea’s highest-profile officials, career diplomat Ri Su Yong, follows a flurry of weapons tests in the run-up to the first congress in 36 years of North Korea’s ruling Workers’ Party in May, when young leader Kim Jong Un consolidated his control.

China is reclusive North Korea’s only major ally but has been angered by its nuclear and missile programs.

China signed up to harsh new U.N. sanctions against North Korea in March in response to its fourth nuclear test in January and a satellite launch in February.

Xi told Ri that China attached great store to the friendly relationship between the two countries, and was willing to work with North Korea to consolidate that friendship, China’s Foreign Ministry said.

“China’s position on the peninsula issue is clear and consistent. We hope all sides remain calm and exercise restraint, increase communication and dialogue and maintain regional peace and stability,” the ministry cited Xi as saying.

There was no direct mention of Tuesday’s failed missile test, the latest in a string of unsuccessful ballistic missile tests by North Korea.

Ri passed on a verbal message to Xi from Kim, the ministry said, in which Kim expressed a desire to work hard with China to maintain peace and stability on the peninsula and across northeast Asia.

Xi welcomed Ri’s visit to report on the North Korean party congress, which Xi said showed the importance Kim attached to ties with China, the ministry added.

Xi said he hoped North Korea could achieve even greater achievements in improving its economy and people’s livelihoods, the ministry said.

Kim has yet to visit China since assuming office after his father died in 2011.

Chinese state television showed pictures of the two men meeting in Beijing’s Great Hall of the People.

The United States plans to use high-level Sino-U.S. talks in Beijing next week to discuss ways to bring greater pressure to bear on North Korea to abandon its nuclear ambitions, a senior U.S. official said on Tuesday.

But China has been reluctant to take tougher action, such as completely shutting its border with North Korea, for fear that North Korea could collapse in chaos.