Pakistani Prime Minister Nawaz Sharif has met with China's President Xi Jinping during an official visit to Beijing focused on courting Chinese investment.

The visit that began Thursday is Sharif's first to his country's close ally since he returned to power in June. The nations cooperate closely in diplomatic and military affairs, and share a common rival in India.

Sharif is hoping to attract greater Chinese investment, including in rail and road links linking the Chinese border to the Arabian Sea port of Gwadar, control of which was transferred to a state-owned Chinese company in February.

Pakistan is also seeking Chinese help in overcoming a chronic energy shortage, while China wants Pakistan to crack down on insurgents from China's Uighur minority who have taken refuge in Pakistan's lawless north.