A peace deal aimed at ending 30 years of military conflict between Acehnese separatist rebels and the government was almost derailed just before it was accepted on Sunday afternoon.

The rebel negotiators, realizing that an Indonesian troop withdrawal was not as substantial as they had expected, debated among themselves for the next 21/2 hours, according to a team adviser, Damien Kingsbury. "They either initialed it or the whole deal was off," said Kingsbury, an Australian academic.

Finally, taking a leap of faith, the Free Aceh Movement rebels decided to initial the agreement, to hugs and handshakes at the venue of their talks, a 250-year-old mansion in Helsinki provided by the Finnish government.

The accord is intended to end a conflict in which about 15,000 people have been killed, including civilians caught in the crossfire as the Indonesian military hunted down the rebels. Peace in Aceh, located on the northern tip of Indonesia's Sumatra island, would also facilitate international relief efforts in the region, still recovering from the Dec. 26 Indian Ocean earthquake and tsunami. More than 100,000 people were killed in Aceh, and hundreds of thousands more were left homeless.

Under the agreement, which awaits formal approval, Indonesian military personnel would be reduced over a four-month period from 35,000 to 13,000 and police officers from 15,000 to 9,800, and both soldiers and rebels would cease fighting under the auspices of a European Union monitoring team, officials said.

The problem, Kingsbury said, was that the number of remaining troops would be about double the amount expected for a regional military command.

Hamid Awaluddin, the head of the government negotiating team, would not discuss troop numbers but said he was "very confident" that the military would honor the agreement.

Both sides said the agreement could still founder if the government does not honor its commitment to create the conditions for local political parties, if the military or the rebels refuse to lay down arms, or if the national assembly rejects the deal.

"We cannot say that this is perfect, no," Nurdin Abdul Rahman, a member of the rebel team, said in a telephone interview from Stockholm, where leaders of the rebels, known by their Indonesian acronym GAM, live in exile. "But now we are dependent on the genuine sincerity of both sides."

Details of the agreement are not expected to be made public until the formal signing on Aug. 15 in Helsinki. But several team members and a government official discussed the process Monday, offering some provisions of the pact, describing how it almost fell apart and outlining the challenges they face.

The main sticking point was whether people in Aceh would have the right to form local political parties, the officials said. GAM negotiators said the issue was pivotal in their goal of achieving self-government in Aceh province, after they had made a key concession by dropping their demand for an independent state.

The government, on the other hand, did not want to grant concessions to the rebels in Aceh that went beyond the rights of political parties in other provinces. Indonesian law requires that political parties have representation in at least half the country's 32 provinces.

Kingsbury, a lecturer on international development at Deakin University, said the sides had agreed to a two-stage process that would allow people in Aceh to form local parties within 18 months of the deal signing. The process would require the national assembly to change current law, something that is far from assured.

In the end, it came down to a single word change, he said. The government agreed to modify "willing" to "will," an important semantic shift that signaled not just intent but a commitment to facilitating the creation of local political parties in Aceh, Kingsbury said.

It took four more hours of bargaining, but the government side eventually agreed, Kingsbury and Rahman said.

"The principle was there, but the wording was difficult," Rahman said.

Past cease-fire agreements have broken down -- three times in the last few years -- so the rebels are wary about whether this agreement will hold, they said. On Friday, Rahman received word that a cousin who is a GAM member had been shot and killed by the military while visiting his ailing mother at her home that morning. He almost stayed away from the talks that day, but decided that would send the wrong signal. He said the government delegation expressed regret for the killing.

Indonesia's military chief, Gen. Endriartono Sutarto, said Monday in Jakarta that the military would abide by the agreement but that it would not leave Aceh "until GAM puts down its guns."

Reactions from the Acehnese people were mixed. "I am so happy and excited to hear" the news, said Azwar Abubakar, acting Aceh governor, reached by telephone while he was on a Muslim pilgrimage to Medina, Saudi Arabia. "This is what we have been waiting for for so long."

Special correspondent Yayu Yuniar contributed to this report.