The beating left Anwar with a black eye that defined in one image the charismatic leader's fall from grace in a power struggle with his mentor, Mahathir Mohamad.
Anwar, once a rising star on his way to prime ministership, will also receive unspecified financial compensation in the out-of-court settlement he reached with former Inspector General of Police Abdul Rahim Noor and his co-defendants, Mahathir, the then-prime minister and home minister, and the government, lawyers for both sides told the court.
A statement read in court on Wednesday by Abdul Rahim's lawyer, Joseph Ting, said: "I Tan Sri Abdul Rahim Noor accept responsibility for the ... assault. The pain and hurt caused to you and to your family is deeply regretted. I sincerely apologise to you Datuk Seri Anwar Ibrahim and your family for the same."
Tan Sri and Datuk Seri are honorifics bestowed by the government.
Anwar, 58, filed a civil suit against the three parties because of a beating he received from Abdul Rahim that resulted in several injuries including the black eye, photos of which appeared on front pages around the world.
Abdul Rahim was said to have punched and slapped a blindfolded Anwar as he sat handcuffed to a prison bed.
Photos of Anwar's black eye
indicated the extent of assault
Anwar also said his back was injured in the assault, forcing him to undergo surgery last year.
Abdul Rahim was charged in May 1999 with assaulting Anwar on the night of his arrest, 20 September 1998.
"I, my family, accept the apology," said Anwar, dressed in a dark suit, who sat impassively in court as the apology was read out.
"There is no point in going on with this episode. The pain, anguish and humiliation were huge, but I agree that we have to move on," Anwar said, indicating he may also drop his demand for a public apology from Mahathir.
"It's not a personal vendetta," he told reporters before leaving to shouts of "Reformasi" by scores of supporters.
"Reformasi" had been the battle cry of his supporters when he led weeks of street demonstrations against Mahathir to demand democratic reforms and an end to cronyism after he was fired on 1 September 1998.
Abdul Rahim was forced to resign over the beating - the first police chief to quit for committing impropriety - and was sentenced to 60 days in prison.
Anwar (R) led protests against
Mahathir Mohamad(L) for reforms
He served just one-third of his term, which was reduced for good behaviour. Abdul Rahim was not present in court on Wednesday.
After his ouster, Anwar served six years in jail for sodomy and corruption - charges he claimed were part of a political conspiracy.
Anwar was freed last year after successfully appealing against the sodomy charge. He had already served the corruption sentence.
Earlier, Anwar's attorney Jagdeep Singh Deo told the court that the matter had been resolved by the two parties.
Lawyers on both sides declined to say how much compensation Anwar would receive or whether it would be paid by Abdul Rahim or by the government.
Anwar said it was a token amount that he would use to cover his legal fees. Despite being free now of all legal encumbrances against the government, Anwar is barred from politics until 2008 because of the corruption conviction.