Prime Minister Ehud Barak defused a mini-crisis in his government today by heading off the threatened defection of his largest coalition partner over a school funding dispute.

The threat to quit the government was posed by the ultra-Orthodox Shas party, which accounts for a quarter of the parliamentary seats in Barak's coalition and which had insisted on a bigger slice of the budgetary pie.

Shas's threat caused a flap here despite conforming to a mid-winter ritual of Israeli politics. As the deadline for passing the annual budget looms in late December, Shas and other parties have often engaged in such brinkmanship.

Nonetheless, the stakes this year were particularly high. Shas's departure would have left the prime minister with the support of just 51 of the 120 members of parliament and thus in a weakened position going into intensive peace talks with Syria and the Palestinians.

After marathon meetings between Shas party leaders and government officials late Monday and all day today, both sides said a deal was all but finalized and a crisis had been averted. "In principle, we're on our way," said Shas leader Eliahu Yishai, Israel's minister of labor and social affairs.

Finance Minister Avraham Shochat, who negotiated on behalf of Barak, did not spell out the precise allocations agreed upon but insisted the government had not been extorted. "There's nothing to be ashamed of," he said.

Shas was demanding funds to bail out its heavily indebted school system, which has had little government oversight in the past. The Shas school network, which enrolls about 20,000 students, stresses the study of Torah--Jewish scripture--and accounts in large part for the party's tremendous popularity with lower- and middle-income parents.

According to Israeli media reports, the government agreed to cover about half the $24 million in debts accumulated by the Shas school network, as well as to channel nearly $40 million into the system's current operations.

In return, Shas agreed to close and consolidate a number of its smaller and money-losing schools and to allow greater government oversight.