A former Texas prosecutor who won a conviction that sent an innocent man to prison for nearly 25 years agreed Friday to serve 10 days in jail and complete 500 hours of community service.

Ken Anderson also agreed to be disbarred and was fined $500 as part of a sweeping deal that was expected to end all criminal and civil cases against the embattled ex-district attorney, who presided over a tough-on-crime Texas county for 30 years.

Anderson faced up to 10 years in prison if convicted of tampering with evidence in the 1987 murder trial of Michael Morton, who wrongly spent nearly 25 years in prison.

Morton was released in 2011 after DNA evidence showed he didn't beat his wife to death. He watched from the front row of the gallery Friday as the man who helped convict him now sat at the defense table, just as he once did. Morton smiled and was hugged by family members after the judge adjourned.

"In a case like this, sometimes it's hard to say what meets the ends of justice and what doesn't. There is no way that anything we can do here today can resolve the tragedy that occurred in these matters," Judge Kelly G Moore said Friday. "I'd like to say to Mr Morton, the world is a better place because of you."

Michael Morton leaves a courthouse on 4 October 2011 after being released from prison after almost 25 years. Photograph: AP

Anderson has previously apologized to Morton for what he called failures in the system but has said he believes there was no misconduct.

Anderson accepted the plea deal in the same Williamson County courthouse where he later spent 11 years as a state judge. He resigned in September.

Since being freed from prison, Morton has become a visible embodiment of problems in the legal system in Texas, which leads the nation in prisoners set free by DNA testing — 117 in the last 25 years. Earlier this year, the former Republican chief justice of the Texas Supreme Court urged lawmakers to act on the issue.

Morton was a regular presence at the Texas Capitol this spring and helped push through the Michael Morton Act, which helps compel prosecutors to share files with defense attorneys that can help defendants' cases.

In an unusual move, the plea deal bundled a resolution to both criminal and civil cases against Anderson. The State Bar of Texas had accused him of professional misconduct in the Morton case, while a special court of inquiry pursued the felony charges this year.