Ulysses Rodriguez Charles, who spent about 18 years in prison after being wrongfully convicted of raping three women in a Brighton apartment, has settled a federal civil rights lawsuit against the City of Boston for $3.25 million, according to a city lawyer.

Charles and lawyers for the city reached the settlement earlier this month, averting a trial in US District Court in Boston, William F. Sinnott, the city’s corporation counsel, said yesterday.

The deal came eight months after a state jury in a civil trial cited “clear and convincing evidence’’ in declaring that Charles was innocent of the 1980 rapes and was entitled to $500,000 under the state’s wrongful conviction compensation law.

“There are five victims in this case,’’ Charles’s lawyer, Frank C. Corso, said yesterday. “There are the three women who were raped. There is the man who spent 18 years in prison for a crime he did not commit. And there’s society, which is paying money and not solving a crime.’’

Charles, 59, a former welder, has continuing legal problems, however. Federal immigration authorities still intend to deport him to his native Trinidad, said Corso, who is opposing the effort. The authorities have been seeking to remove him for years as a result of other criminal convictions, including one in 1989 for trafficking heroin while in prison.

In October 2008, US District Court Judge Nancy Gertner urged immigration authorities not to deport Charles until after his civil rights lawsuit against the Boston Police Department had gone to trial. The trial was tentatively scheduled for Nov. 30 of this year but was put off because of settlement talks.

Even though Charles’s convictions were overturned in May 2001 and a Suffolk Superior Court jury vindicated him in April of this year under the wrongful conviction compensation law, the city has never exonerated him.

Sinnott said lawyers for the city and Charles “engaged in long and thoughtful deliberations, and this is a settlement that both sides are satisfied with.’’

Charles, who had worked for General Dynamics building Navy ships, was convicted in 1984 of breaking into an apartment on Commonwealth Avenue in Brighton and raping three female roommates, one of whom was threatened with a screwdriver to the throat. He was sentenced to 80 years in prison.

His convictions were overturned and he was freed after DNA testing revealed that semen found on a robe and bedsheet of one of the victims belonged to two other men and that his DNA was not found in the apartment. Charles’s defense lawyers contended that police and prosecutors deliberately withheld evidence that could have cleared him.

Suffolk County prosecutors declined to retry the criminal case, saying two decades had passed since the rapes, evidence had been lost, and investigators had died.

But they insisted that the DNA evidence did not clear Charles because jurors at the trial had been told the rapist did not ejaculate.

In addition, two of the women who were raped told the Globe after the conviction was overturned that they had no doubts that Charles was the assailant.

After Charles was freed from prison, he was immediately taken into custody by immigration authorities who sought to deport him for other convictions.

But a federal judge released him in August 2002, pending a ruling by an immigration judge.

In October 2003, an immigration judge ordered his deportation, which was upheld by the Board of Immigration Appeals and the Court of Appeals for the First Circuit.

The board and the appeals court rejected his argument that he had become a US citizen by filling out a declaration of intention with immigration authorities in Boston in 1973.

Charles suffered devastating personal losses while in prison, his family has said, including the suicide of a daughter.

Saltzman can be reached at jsaltzman@globe.com

© Copyright 2009 Globe Newspaper Company.