JERUSALEM >> As president, Jimmy Carter brokered the watershed peace agreement that removed Israel’s most powerful enemy from the battlefield. But he incurred the Israeli government’s wrath decades later when he said its military rule over the Palestinians amounted to apartheid.

The Camp David peace accords, signed by Israel and Egypt in 1978, remain the biggest achievement from decades of mostly failed U.S. peacemaking in the Middle East.

But for Carter, who died on Sunday at age 100, they were clouded by what he saw as the continued oppression of the Palestinians and Israel’s expansion of settlements on lands they want for a future state.

Carter did not speak publicly after entering hospice care, months before the outbreak of the latest war in Gaza. But he devoted much of his life during and after his presidency trying to broker a just solution to the wider conflict.

Peace for Israel, Egypt

When Carter assumed office in 1977, Egypt and Israel had fought four devastating wars, the last of which began with an Egyptian surprise attack in 1973 that initially seemed to threaten Israel’s existence.

Carter’s efforts led to Egyptian President Anwar Sadat’s landmark visit to Jerusalem and saw U.S. negotiators eventually wear down famously hawkish Israeli Prime Minister Menachem Begin.

“There would not be a peace agreement between Israel and Egypt without President Carter,” said Aharon Barak, a former Israeli attorney general and Supreme Court president who served as the Israeli legal adviser during the negotiations.

Barak described Carter as a dogged negotiator, forcing the sides to work from 6 a.m. until after midnight and getting involved in the smallest details.

“He was very tough, knew what he wanted, and he got what he wanted. And I admired it,” he said.

The first peace treaty between Israel and an Arab country saw Israel withdraw from the Sinai Peninsula, which it had captured in the 1967 Mideast war, and forge full diplomatic ties with Egypt, which had led the Arab struggle against Israel since its establishment in 1948.

The two countries remain at peace nearly a half-century later.

Efforts languished

Although the Camp David agreements called for a transition to Palestinian self-government in the West Bank and Gaza, which Israel also seized in 1967, it was never carried out. Carter was voted out of office two years later amid the Iran hostage crisis, and Mideast peace efforts languished.

When Israelis and Palestinians finally came together to sign the Oslo Accords in 1993, the plan was similar to the one Carter had written 15 years earlier, with the creation of a Palestinian Authority and Israel’s gradual withdrawal from the occupied territories.

But the peace process stalled out yet again in 2000, when the sides were unable to reach a final agreement at Camp David. An armed Palestinian uprising erupted months later.

Outreach to Hamas

In April 2008, 83-year-old Carter toured the region with the Elders, a group of retired international leaders founded by Nelson Mandela. He once again courted controversy by meeting with the top leaders of the Islamic militant group Hamas, which had recently seized control of the Gaza Strip. Hamas does not accept Israel’s existence and has carried out hundreds of deadly attacks over the years.

But Carter said he had secured a personal commitment that Hamas would accept a Palestinian state on the 1967 borders if the agreement were approved in a Palestinian referendum.

The Israeli government refused to meet with Carter, and both Israel and the U.S. criticized his decision to meet with Hamas.