PERUGIA, Italy — A court here overturned the homicide convictions of the American college student Amanda Knox and her Italian co-defendant on Monday and ordered them freed after nearly four years in prison, ending a sensationally lurid trial of murder and rough sex that had made Ms. Knox notorious on both sides of the Atlantic.

. . .

The decision overturns the December 2009 ruling that convicted Ms. Knox to 26 years in prison and her co-defendant, Raffaele Sollecito, a former boyfriend, to 25 years in prison for the 2007 stabbing murder of 21-year-old Meredith Kercher, a Briton who shared an apartment with Ms. Knox. The case was built largely on DNA evidence that legal experts called flimsy and suspect.