The site was not Camp David, but the Windsor Golf & Country Club on the outskirts of Nairobi. And the presidents who waited in separate cottages overlooking the practice green hailed not from the Middle East but from a pair of countries most Americans might be hard pressed to find on a map.

Yet there was Jimmy Carter, beating a path between enemies on a cool Kenyan morning, pushing to help end an obscure conflict in a remote place where the former president has been busy for half of the nearly two decades since he left office.

"The war in Sudan is perhaps the worst war since the Second World War, with more than 2 million deaths, 4 million people displaced," said Carter of the conflict at the heart of his shuttle diplomacy between cottages last week. "I've been working on this peace agreement since 1989."

The accord Carter coaxed into existence Wednesday involved Uganda and Sudan, bitter foes that for most of the decade have fomented armed rebellion against each other across a scrubby, semiarid border.

Presidents Yoweri Museveni of Uganda and Omar Hassan Bashir of Sudan are garrulous men who do not speak to each other. But both spoke to Carter, having come to know him early in his campaign to eradicate Guinea worm disease, a plague that has been nearly wiped out under an effort headed by the Atlanta-based Carter Center.

The last pocket of resistance to the gruesome disease--in which a larva can grow three feet long by the time it works its way through its victim's skin--is in southern Sudan and northern Uganda. The fighting there has kept health workers from moving against the worm.

"The cross-border problems are bad enough," said Joyce Neu, the Carter Center conflict resolution specialist who led the months of secret negotiations that culminated in last week's agreement. "But there is this other component."

Five years ago, Carter negotiated a truce between the Sudanese government and the rebels in the south--the Sudanese People's Liberation Army, or SPLA. "The "Guinea worm cease-fire" was named for the cause that occasioned the pause.

But the fighting resumed. And a plague of another type emerged: a rebel group known as the Lord's Resistance Army.

The LRA is best known for attacking schools in northern Uganda and carrying away children to bases in Sudan. Girls become sex slaves. Boys are forced to become soldiers, often after being forced to kill another child. Under leader Joseph Kony, whom a Uganda newspaper claims is critically ill with AIDS, the LRA may have abducted as many as 20,000 children.

Sudan tried to justify its protection of the LRA by pointing out that Uganda was aiding the SPLA. The standoff wrecked relations. But six months ago, both presidents, under mounting internal pressure to make peace, asked Carter to mediate their differences.

"The two presidents were totally incompatible," Carter said. "They would rarely go to the same meetings. When they did, they would avoid one another."

Before bringing them together, the Carter Center's conflict resolution experts discreetly arranged meetings with officials from both governments in a contact group. The first session was in London, the second in Africa.

By the time Carter headed to Mozambique to monitor elections two weeks ago, the two sides were close enough that the meeting with the heads of state was arranged for Nairobi.

Each took up quarters in a $600-a-night cottage. Carter shuttled between the two, employing the same method he used to broker the Camp David peace accord between Israel and Egypt 20 years ago: A single text was stored in his laptop computer. He carried a printout of the latest version from one party to the other.

"They didn't see each other until after they both agreed to the language," Carter said. "I went back and forth between the two."

Absent, however, were representatives of the rebel movements whose future could be determined by the agreement, provided it is carried out. "They very rarely leave the bush" was how Carter explained their absence.

He sent a letter of explanation to SPLA leader John Garang, who has a home in Nairobi and who was quoted this week as saying his forces would not be affected by the agreement. The LRA's elusive Kony was invited (in a letter carried by a go-between) to "participate in the process," Neu said.

The LRA leader replied in a letter saying that he would come, but was not heard from again. Leaders of a second rebel group Sudan is believed to be supporting in Uganda, the Allied Democratic Forces, were not invited.

The 11-point agreement calls for the countries to reestablish diplomatic ties and desist from aiding groups hostile to the other. Point No. 8 promises "a special effort to locate any abductees, especially children . . . and return them to their families."

"We are very interested in the abducted children," Carter said.