(Reuters) - A divided Connecticut Supreme Court on Friday threw out the 2002 murder conviction of Michael Skakel, a member of the Kennedy family, and ordered a new trial.

FILE PHOTO: Michael Skakel reacts to being granted bail during his hearing at Stamford Superior Court, in Stamford, Connecticut November 21, 2013. REUTERS/Bob Luckey/Pool

The 4-3 decision upheld a lower court judge’s 2013 ruling that Skakel’s lawyer did not provide an adequate defense, necessitating a new trial on charges that he killed his neighbor Martha Moxley at her Greenwich home in 1975.

Justice Richard Palmer, writing for the majority, said the trial lawyer had failed to present the jury with testimony from a witness who could have provided an alibi for Skakel.

Palmer said the prosecutors’ case was “far from strong,” and the outcome might have been different with the alibi testimony.

“This has been a long road for Michael, and we are grateful to the court for its ruling today,” said Hubert Santos, Skakel’s lawyer in the appeal.

Skakel, a cousin of Robert F. Kennedy Jr. and nephew of Ethel Kennedy, the widow of U.S. Senator Robert F. Kennedy, was sentenced to 20 years in prison before he was freed on bail when state Superior Court Judge Thomas Bishop ruled that his attorney had failed to provide an effective trial defense.

In 2016, the Connecticut Supreme Court rejected Bishop’s conclusion and reinstated Skakel’s conviction, prompting Santos to ask the court to reconsider its decision.

Since the 2016 ruling, one justice in the majority retired and was replaced by another justice, who voted in favor of ordering a new trial, thus flipping the court’s decision.

In a dissenting opinion, Justice Carmen Espinosa said Skakel’s decision to file a motion for reconsideration after a justice’s retirement amounted to “judge shopping.”

A spokesman for the Connecticut chief state’s attorney’s office, which argued against Skakel’s appeal in court, said the office was reviewing the decision.

The case drew enormous media attention, both because of the connection to the Kennedys and because the murder took place in Greenwich, one of New York City’s toniest suburbs.

Moxley was found bludgeoned to death with a golf club, later traced to a set owned by Skakel’s mother, when she and Skakel were both 15 years old.

The case was unsolved for more than 20 years. In 1998, former Los Angeles police detective Mark Fuhrman, known for his role in the O.J. Simpson murder case, wrote a book implicating Skakel.

A grand jury was convened that year, and Skakel was charged in 2000.