BOSTON — A suspect in two violent rapes in Boston a decade ago has been freed because DNA testing could not differentiate him from his identical twin brother.

Dwayne McNair was released by a judge Tuesday after spending two years behind bars awaiting trial.

Prosecutors, meanwhile, say they plan to conduct additional DNA testing using an expensive new method developed by a German company that can distinguish between identical twins, and could re-indict depending on those results, the Boston Herald reported. The test costs $120,000.

Superior Court Judge Christine McEvoy said the test, which could take months to complete, would deprive McNair, 33, of a fair and speedy trial. He had been held on $3.3 million bail.

Prosecutors asked for the new DNA test two weeks before Tuesday's trial date, and McEvoy said, "My concern is the delay in the case based on the request being made so late in the case."

McNair's mother said she's happy he's out. The judge did not impose any conditions while he is free.

McNair's lawyer says his client realizes he's not in the clear yet.

"He's had these charges hanging over him for a while now, and he wants to have this trial and get on with the rest of his life," Robert Tobin said outside court. "He can walk today, but he still has to deal with the whole cloud of the thing hanging over his head."

Another man has already pleaded guilty to the rapes and implicated McNair as a co-conspirator.

The 23- and 19-year-old victims were abducted at gunpoint off city streets within days of each other in 2004, pistol-whipped and raped, prosecutors said. McNair wasn't linked to the crimes until 2011 and was indicted in 2012.