KABUL, Afghanistan — After courting Pakistan for more than a year, President Ashraf Ghani of Afghanistan changed course on Monday and warned that he would lodge a complaint with the United Nations Security Council if Pakistan refuses to take military action against Taliban leaders operating from its soil to wage an increasingly deadly insurgency across Afghanistan.

Mr. Ghani has tried to persuade Pakistan’s leadership, particularly its powerful military, to bring the insurgent leaders to the negotiating table. But an increase in Taliban violence, including a brutal attack last week in the heart of Kabul that killed at least 64 people and wounded more than 300, has forced the Afghan president to effectively end the negotiations, which have been a cornerstone effort of his troubled time in office.

“I want to make it clear that we do not expect Pakistan to bring the Taliban to talks,” Mr. Ghani said Monday in a rare joint session of the two houses of the Afghan Parliament. “If we do not see a change, despite our hopes and efforts for regional cooperation, we will be forced to turn to the U.N. Security Council and launch serious diplomatic efforts.”

In quadrilateral talks over the past year that also involved the United States and China, Pakistan had pledged “in writing” to go after Taliban leaders who refused to join the peace process, Mr. Ghani said.