A man who has spent 21 years behind bars for a murder he says he did not commit will be released from prison until a new trial can be held, a state judge ruled Monday.

Essex County Superior Court Judge David Lowy officially vacated a life sentence imposed on Angel Echavarria for the 1994 shooting death of Daniel Rodriguez in Lynn.

Echavarria, 48, will be required to wear a GPS monitoring device and remain in Massachusetts pending the new trial, according to Essex County District Attorney Jonathan Blodgett's office. He will also not be allowed to obtain a passport.

Carrie Kimball-Monahan, a spokeswoman for Blodgett, said Echavarria will be released from the courthouse after being outfitted with the monitoring device. She said Blodgett's office is reviewing the case to determine whether it will appeal the judge's decision to grant a new trial or simply move to try the case again.

The new trial was prompted by a decade long investigation by the Schuster Institute for Investigative Journalism at Brandeis University.

The institute found a number of legal problems, including inconsistent testimony from witnesses and poor legal representation from Echavarria's lawyer. The state public defender's office sought a new trial in 2010 based largely on the institute's investigation; a judge granted the new trial April 30.

The state's case against Echavarria was based mostly on eyewitness testimony from the victim's brother, who did not speak English, had problems explaining basic concepts such as time and distance, did not know the day of the week or what city he was in, was a habitual marijuana user and had been drinking the night of the slaying, according to the institute.

The eyewitness described the shooter as a 20-year-old, clean-shaven Puerto Rican man with a "stocky" or "chunky" build. Echavarria, from the Dominican Republic, is 5-foot-10 and, in 1994, weighed 135 pounds and had a full mustache.

Lowy based his April decision in part on the ineffectiveness of Echavarria's original trial lawyer, who did not cross-examine the victim's brother as thoroughly as he could have and did not give Echavarria the chance to testify in his own defense.