ISLAMABAD (AP) — Pakistani political leaders Monday endorsed government efforts to negotiate with militants in the tribal regions while distancing themselves from a war that they portrayed as being foisted on them by the U.S. invasion of Afghanistan.

Pakistan has been battling militants in the northwestern part of the country for years who do not recognize the authority of the government.

Thousands of civilians and members of the security forces have been killed in bombings and shootings carried out by the militants but the war has been unpopular with many in the country who see it as a battle against their own people at the behest of the U.S. and Afghanistan.

The announcement came after a meeting of politicians from the major political parties at the prime minister’s residence to discuss the country’s precarious security situation. The meeting was also attended by the head of the Pakistani army, Gen. Ashfaq Parvez Kayani, and the head of the Inter-Services Intelligence, the country’s spy agency.

In a statement following the meeting, the political leaders called upon the government to “initiate dialogue with all the stakeholders” and authorize the government to do what was necessary to bring about negotiations.

“We declare that we shall ourselves determine the means and mode of fighting this war in our national interest and shall not be guided by the United States of America or any other country in this regard,” the statement said.

The statement also condemned the U.S.’s use of drones in the tribal region to kill militants.

Prime Minister Nawaz Sharif came into office in June saying he supported talks instead of military operations to bring about peace.

Monday’s announcement gives him the political backing he wanted to try to negotiate with the militants.

Previously the Pakistani Taliban, the main militant group fighting in the tribal regions, had rejected Sharif’s talk of negotiations. But a spokesman for the group Monday welcomed the announcement.

“It is for the first time that the government has shown seriousness,” said Shahidullah Shahid. He said the executive council of the group would meet in the next few days to discuss the announcement and will issue a response then.

Critics of talking with the Taliban point out that militants and the government have come to numerous agreements over the years only to see the militants break their end of the deal. Many accuse the militants of using the negotiations as a way to buy time while they consolidate their power.

The U.S. and Afghanistan insist that clearing the tribal regions of safe havens for militants is key to securing peace in Afghanistan, but the statement distanced Pakistan from ownership of the military campaign. It blamed the thousands of deaths in part on “blow-back from actions of NATO/ISAF forces in Afghanistan.”

The announcement came the same day that newly-elected President Mamnoon Hussain was sworn into office in a ceremony at the presidential palace. Hussain took over from former President Asif Ali Zardari who stepped down on Sunday after completing his five-year term.

Hussain is a textile businessman who is a longtime member of Sharif’s Pakistan Muslim League-N. He served as governor of Sindh for about four months in 1999 but has not been a prominent figure in national politics.

During Zardari’s term the presidency was largely reduced to a ceremonial role after constitutional reforms returned much of its powers to the prime minister’s office.