BEIJING (Reuters) - A vice minister of public security, a close confidant of President Xi Jinping, is tipped to take over as China’s spy master, five sources said, as the country looks to clean up its security apparatus and plug intelligence gaps.

Wang Xiaohong, head of Department of Public Security of Henan province, is pictured in Zhengzhou, Henan province, China January 17, 2014. Picture taken January 17, 2014. REUTERS/Stringer

China has poured billions of yuan into domestic security, but the secretive Ministry of State Security and the Ministry of Public Security in recent years have been hit with high-level corruption scandals and intelligence failings.

Wang Xiaohong, 60, a vice minister of public security, will replace Chen Wenqing as minister of state security during the session of parliament which begins on March 5, three sources with ties to the leadership and two foreign diplomats said.

Chen, 58, will become the country’s top prosecutor after a little more than a year as minister of state security, three of the sources said. The ministry is responsible for counter-intelligence, foreign intelligence and national security.

The change of guard is part of a broader cabinet reshuffle during the two-week parliamentary session.

Wang and President Xi have long-standing ties. Wang is a native of the southeastern province of Fujian, where Xi spent 17 years cutting his teeth from 1985 to 2002.

Wang was deputy director of the Public Security Bureau of Fuzhou, the provincial capital of Fujian, from 1993 to 1998 and the city’s top police official from 1998 to 2002. Xi was Fuzhou party boss from 1990 to 1996 and provincial deputy party secretary until 2002.

“They are very close,” a source with leadership ties said. “Wang Xiaohong used to help look after Xi Jinping’s daughter.”

A second source with leadership ties said Wang’s rise had been fast-tracked in the same vein as other allies whose careers had overlapped with Xi in Fujian, most notably the Beijing party secretary Cai Qi, and Huang Kunming, who was promoted to head the central propaganda department late last year.

Wang, a one-time fan factory worker joined the police force in Minhou county in Fujian in 1979.

Neither the Communist Party’s Organisation Department, which oversees personnel decisions, nor the State Council Information Office, which doubles as the party spokesman’s office, responded to a request for comment.

The Ministry of State Security does not have publicly listed contacts.

Xi has made bolstering security, both domestic and overseas, a priority.

In 2013, a year after Xi assumed power, China set up a new national security commission, which Xi also heads. While details of exactly how it operates and what it does are sketchy, the government has implied it has more of a domestic focus.

Experts say it is based on the National Security Council in the United States and would increase coordination among the various wings of China’s security bureaucracy, split now among the police, military, intelligence and diplomatic services.

Possible international flashpoints for China include North Korea, Taiwan and the South China Sea.

The Ministry of State Security is also still recovering from a graft scandal.

In 2015, Ma Jian, then counter-intelligence chief at the ministry, was put under investigation for corruption and expelled from the party the following year. There has been no official update on his case since February last year, when China’s judiciary said it would prosecute him for suspected bribery.

A video confession surfaced on Chinese websites and social media in April in which Ma admitted to accepting bribes. He also said he abused his position to help China’s highest profile fugitive, Guo Wengui, an exiled U.S.-based billionaire who has made incendiary claims of corruption at the highest levels of the Chinese government.

Guo has denied Ma’s allegations.

Ma, once a vice minister of state security, is the most senior security official to be investigated since the former domestic security tsar Zhou Yongkang was ensnared in a graft scandal and jailed for life in 2015.

The government announced in February last year that Ma would be prosecuted, but has given no other information since.

“He’s coming in to sort out the mess Ma left behind,” said one Asian diplomat, speaking of Wang, the likely new minister.

While China’s domestic security spending outstrips defense spending, though the government stopped providing exact figures four years ago, it has also struggled with some pointed intelligence failures.

One of those has been to prevent Uighurs, a Muslim people from China’s far western region of Xinjiang, from traveling clandestinely to Turkey via Southeast Asia, where China says some of them have joined militant groups in Syria and Iraq.

“China has poor intelligence on their movements and has been unable to produce much evidence” that they are indeed involved in militancy, said another diplomatic source, who is familiar with Chinese efforts to prevent the Uighurs from leaving and then trying and get them deported back to China.