Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

RAWALPINDI, Pakistan — Pakistan’s decision this week to finally detain the alleged mastermind of the 2008 Mumbai terror attacks signals a broader shift in the country’s treatment of extremists.

Placing Hafiz Saeed under house arrest was driven in part by President Donald Trump’s arrival on the world stage as well as pressure from China, according to military insiders and experts.

"Recent indicators from our friends, the U.S. and China, are that he has to go," said a senior officer on the sidelines of a rare briefing held at the military’s General Headquarters in Rawalpindi.

This pronouncement came less than 24 hours after Monday's arrest of Saeed, an extremist who espouses “jihad,” or holy war, with India.

The U.S. has a $10 million bounty on his head, and India accuses him of being the mastermind of the Mumbai attacks that left 166 dead, including several Americans.

"The U.N., the Americans, et cetera, have been asking questions about how the state has not been able to control this man,” said the officer, who spoke on condition of anonymity because he is not authorized to speak to the media.

"The contradictory policy of duality — support for some militants and going against others — will soon be finished."

Often a guest on conservative television talks shows, the popular jihadist could still attract large crowds with his anti-American and anti-Indian diatribes in rallies and protests.

Like much of Pakistan's establishment, Saeed was virulently anti-India, and campaigned against New Delhi’s occupation of the disputed territory of Kashmir for years. Authorities had apprehended and released Saeed in the past — a sign of their sometimes contradictory attitude toward militants.

Even though Pakistan has been involved in extensive counter-terror and counterinsurgency operations against al Qaeda, the Pakistani Taliban and ISIS — the military says it has lost more than 7,000 soldiers battling terrorists since Sept. 11, 2001 — it is often blamed for selectively harboring certain other militant groups.

Photographers run past the burning Taj Mahal Hotel during a gun battle in Mumbai on Nov. 29, 2008. A commando-style assault killed 166 people. Arko Datta / Reuters, file

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

These include elements of the deadly Haqqani network in Afghanistan, the leadership of the Afghan Taliban leadership, as well as Lashkar-e-Tayyaba, which has targeted India's military positions in disputed Kashmir and is suspected to be linked to Saeed's Jamaat-Ud-Dawa (Party of the Faith) as well as his Falah-i-Insaniyat Foundation (The Foundation for the Welfare of Humanity) charity.

This time looks to be different because Saeed’s arrest, along with four of his deputies, fell under Pakistan’s stricter enforcement of anti-terror laws.

According to Maj. Gen. Asif Ghafoor, the spokesman for Pakistan’s army, the decision was based on a new "national policy and for the national interest."

Shehzad Chaudhry, a former Pakistan air force officer and a popular television analyst told NBC News, said that the government was reacting to "a changing environment."

He added: "This arrest is a win-win decision. The Chinese, our best friends, are going to be happy, for we don't have to embarrass them anymore. The Americans will be happy that we've finally heard them out. The Indians will lose a major excuse to complain about us to the rest of the world."

Hafiz Saeed, the Pakistani leader of Jamaat-ud-Dawa, leaves in a car after being detained by police in Lahore, early on Jan. 31, 2017. Arif Ali / AFP - Getty Images

Another big factor leading to the arrest was a change of the guard inside Pakistan’s influential army.

Gen. Qamar Javed Bajwa, Pakistan's powerful new chief of army staff, who a senior State Department official called “well-intentioned” at a recent background briefing in Islamabad, has a reputation of being religiously progressive and also pro-democracy.

Ghafoor, the military spokesman, added that the new army chief's resolve to improve Pakistan's security is clear: "If Pakistan improves, and the army chief goes to his grave, he would still think it’s all worth it.”

He added: “Individuals are less important than the state. The national interest must prevail."

Ghafoor's analogy is not just rhetorical. Past military leaders, like Gen. Pervez Musharraf, survived assassination attempts after going after Islamist militants previously fostered by the state. They were also publicly slammed for being too close to the Americans.

Soon after his arrest, Saeed released a video statement where he blamed international pressure and Trump’s close ties to Indian Prime Minister Narendra Modi for his arrest.

Local analysts agreed.

“He [Saeed] is not wanted here, is he? He is wanted in the U.S. and India. So obviously we are reacting to their policies,” political analyst Mazhar Abbas said on his local talk show.

Hassan Nisar, another influential analyst, was quoted as saying that if American pressure had helped lead to the arrest “it’s nothing to be embarrassed about. It’s a bitter pill, and we have to swallow it. We have to face the fact that this man was a liability.”

But Michael Kugelman, who watches Pakistan from the Wilson Center in Washington, connected Islamabad’s decision to Trump's recent immigration ban in a column he wrote for Dawn, a local daily newspaper.

"It’s doubtful Trump actively pressured Pakistan to rein in Hafiz Saeed, but it’s likely Pakistan’s detention of Saeed was done with Trump in mind," Kugelman wrote. "We can read the house arrest, at least in part, as an effort by Pakistan to showcase its counterterrorism bonafides to the new U.S. administration, and to dissuade Trump from adding Pakistan to the list of countries that can’t send their citizens to the United States for 90 days. Trump’s chief of staff has suggested Pakistan could be added to the list.”

Supporters of Hafiz Saeed burn effigies of President Donald Trump and Indian Prime Minister Narendra Modi during a rally in Lahore, Pakistan, on Feb. 2. K.M. Chaudary / AP

The detention and overall crackdown comes as Prime Minister Nawaz Sharif tries to normalize relations with arch-rival India and neighbor Afghanistan.

He has been side-tracked by terror attacks linked to Pakistan as well as growing anti-India protests in Indian-administered Kashmir.

As for Pakistan’s changing policy, there are connections to the switch in the leadership of the Army, which Sharif has struggled in dealing with in the past.

Days before Sharif, the PM, appointed Bajwa in November, he told NBC News that "the contradictory policy of duality — support for some militants and going against others — will soon be finished."