ISLAMBAD, Pakistan — The Pakistani government entered into formal talks with Taliban insurgents Thursday, exchanging possible ground rules for how to try reaching a negotiated peace agreement.

A four-member delegation appointed by Prime Minister Nawaz Sharif met for several hours with three representatives of the Pakistani Taliban in what is considered a last-ditch attempt to avoid a major domestic conflict.

The Pakistani Taliban, formed when various militant groups coalesced in late 2007 and early 2008, has been waging a bloody insurgency aimed at imposing a harsh interpretation of Islamic law in overwhelmingly Muslim Pakistan.

Under pressure domestically and abroad to curb the violence, Sharif has been pushing for months to get the Taliban to the bargaining table.

If an agreement is not reached soon, the normally cautious prime minister may be forced to order military action, perhaps as early as this spring or summer.

After the meeting, which was held at a government guest house in Islamabad, the two sides emerged and read a joint statement describing the gathering as “cordial.”

The government delegation, led by Pakistani journalist Irfan Siddiqui, told the Taliban delegation that it wants an immediate cease-fire and for the talks to remain within the framework of Pakistan’s constitution.

For its part, the initial demands of the Taliban delegation, led by a prominent religious scholar, were largely procedural.

Though further talks are expected in the coming days, analysts remain deeply pessimistic that Sharif can reach a meaningful peace treaty with the Taliban.

The Taliban, which includes numerous factions and commanders, is increasingly splintered. Already, there were signs Wednesday of division even among members of the delegation.

Maulana Abdul Aziz, a Pakistani cleric, said he will not participate in the talks unless they include a robust discussion about imposing Sharia law in Pakistan. Sharia law refers to a strict interpretation of Islamic teachings, and would create a moral code that would be enforced by Islamic courts.

But Maulana Yousuf Shah, another member of the Taliban delegation, said it was premature to speculate on what Taliban leaders’ final demands will be.