Nigeria has agreed to hand over the oil-rich Bakassi peninsula to Cameroon in a deal brokered by the United Nations to resolve a tense dispute.
Many Bakassi residents say they do not want to live in Cameroon
UN Secretary General Kofi Annan hosted the talks in New York, which follow a 2002 World Court ruling.
Thousands of Nigerians and a sizeable military force remain in Bakassi. The troops are to leave within 60 days.
The territorial dispute sparked military clashes between the two neighbours during the 1990s.
The deal was reached by Nigerian President Olusegun Obasanjo and his Cameroonian counterpart, Paul Biya.
"Our agreement today is a great achievement in conflict prevention, which practically reflects its cost effectiveness when compared to the alternative of conflict resolution," Mr Obasanjo said.
"It should represent a model for the resolution of similar conflicts in Africa and... in the world at large."
Mr Annan said that under the terms of the deal, the Nigerian troops could be given an extra 30 days to withdraw.
Bakassi juts into the Gulf of Guinea - an area which may contain up to 10% of the world's oil and gas reserves.
It is also rich in fish.
Nigeria has always said it would abide by the ruling but in 2004 said that "technical difficulties" prevented it from handing over the peninsula.
Most of those who live in Bakassi are Nigerians and are strongly opposed to coming under Cameroonian jurisdiction.
The United Nations special envoy for the Bakassi peninsula, Ahmadou Ould Abdullah, said he was optimistic that the agreement would be respected by Nigeria.
Mr Abdullah told the BBC's Network Africa programme that he believed the presence of the UN Secretary General and witnesses from Germany, France, Britain and the United States would help guarantee the agreement was met.
Most Bakassi residents are fishermen
He said there would be a two-year transition period for the Nigerian administration to leave.
Nigerians living on the peninsula would be able to live there under a special regime for four years after Cameroon took control and could stay on after that if they wished.
The 2002 International Court of Justice ruling was based on a 1913 treaty between former colonial powers Britain and Germany.
The agreement also settles the border for 1,690km (1,056 miles) up to Lake Chad.
Some villages further north have already been exchanged.