The bitter divorce battle between Earl Spencer and his wife, Victoria, ended sensationally last night when they reached a settlement after a marathon meeting.
In a statement released jointly on their behalf, the couple said they would be divorced in South Africa shortly.
The statement, delivered by the lawyers for the Spencers, said they withdrew all allegations made in relation to each other in court.
They added the financial settlement would remain private.
The statement read:
"We are glad to be able to say that we have reached a financial settlement in the High Court in Cape Town. This will involve us being divorced in South Africa shortly.
"For the greater part of the three years for which we have been separated, we have had an amicable relationship. This has been primarily for the sake of our children.
"For that same reason, we now aim to rebuild a civilised and friendly arrangement whereby our four children will continue to prosper."
Speculation mounted about a deal after the two sides locked themselves away in lawyers' chambers from about 1.30 p.m. local time.
Conflicting reports emerged from the earl's lawyers all day. At first they said a solution could be reached, but then declared they were discussing legal issues.
The resolution to the case came as the hearing was growing increasingly bitter after allegations that the earl had had affairs with up to 12 women.
Lady Spencer, her father John and the earl's former mistress, Ms Chantal Collopy, were due to appear this week to give evidence against Lord Spencer.
The earl was said to be determined to have his day in court to rebut the allegations, but the statement appears to have ended that.
Lord Spencer's lawyer, Mr Leslie Weinkove, said he could be back in court today.
But he declined to give further details as he handed out statements, flanked by Lady Spencer's lawyer, Mr Jeremy Gauntlett, in the foyer of the chambers where the discussions had taken place.
Lord Spencer walked out of the front of the chambers, but could not get into the garage opposite. He returned to the building, then slipped away without commenting about the settlement.
Mr Weinkove said the divorce could go through as soon as today.
He declined to comment on the details of the financial package or who was claiming victory in the battle.
Before the agreement, Lady Spencer had demanded a settlement of £3.75 million, but the earlonly offered £300,000. He had also offered about £30,000 maintenance a year and other perks, including a luxury bungalow in the exclusive Cape Town suburb of Constantia.
The earl's spokeswoman, Ms Shelley-Anne Claircourt, said last night that both parties were pleased that it had come to an amicable conclusion.