Prime Minister Nawaz Sharif named a new military chief Wednesday, bypassing seniority to install a low-profile army general in the powerful position.

Sharif’s selection of a new army chief of staff after months of deliberations comes as Pakistan is struggling to contain violence by Islamist militants that has killed more than 45,000 civilians and soldiers over the past decade. Pakistan’s military is facing renewed tension with India and is concerned about security in neighboring Afghanistan as most NATO troops prepare to withdraw by the end of next year.

In what is widely viewed as Sharif’s most important decision since he took office in June, he selected Lt. Gen. Raheel Sharif, who hails from a distinguished military family and is the army’s inspector general for training.

Raheel Sharif, no relation to the prime minister, will replace Gen. Ashfaq Kayani as head of Pakistan’s nuclear-armed, 550,000-member military.

After overseeing one of the world’s largest standing armies for six years, Kayani announced in October that he would not seek reappointment to the job.

Pakistan's Lt. Gen. Raheel Sharif attends a military exercise in Khairpure Tamay Wali in Bahawalpur district on Nov. 4, 2013. He was named Pakistan’s new army chief on Wednesday. (Reuters)

Kayani, who was popular in Pakistan and helped stabilize relations with the United States in the aftermath of the killing of Osama bin Laden, will formally hand control over to Raheel Sharif on Friday.

Military officials, speaking on the condition of anonymity, described Raheel Sharif as a “moderate” who considers the threat posed by Islamist militants as important as that posed by neighboring India, with which Pakistan has fought three wars.

Nawaz Sharif’s decision surprised many observers, who noted that the incoming military chief was the third most senior general among the contenders for the job and was not well known outside the army.

Raheel Sharif also does not have deep political ties, even though his older brother, the late Shabbir Sharif, won the country’s highest military award for valor for his service in the 1971 war with India.

Hasan Askari Rizvi, a Lahore-based military analyst, said Raheel Sharif’s low profile probably appealed to the prime minister. In 1999, during his second term in office, Nawaz Sharif was ousted in a coup by then-army chief Pervez Musharraf, who went on to rule until 2008.

“The prime minister could have been looking for someone who is totally focused on military affairs, given his past bitter experiences with military leadership,” Rizvi said.

Still, Raheel Sharif could quickly be tested by the complicated domestic politics over how best to address Islamist militants, including the Taliban.

Despite unease among some military commanders, Nawaz Sharif is pressing for peace talks with the Taliban, a stance backed by several major political parties.

But few analysts expect that peace talks, which Taliban leaders have yet to agree to, will bring an end to violence.

“These are difficult times, and we are in a warlike situation,” said Shaukat Qadir, a former Pakistani military commander. “It will be a big challenge for the new army chief to prove that he is the wartime leader.”

Tim Craig in Kabul contributed to this report.