A man accused of being part in a murder-for-hire scheme linked to the killing of a law professor pleaded guilty on Tuesday to second-degree murder, averting an upcoming trial where he faced the death penalty.

Luis Rivera, who is already serving a 12-year sentence in federal prison for an unrelated charge, was sentenced to an additional seven years behind bars as part of a plea deal he agreed to at a hearing.

Authorities had said that Rivera and another man, Sigfredo Garcia, traveled from South Florida to Tallahassee in July 2014 and gunned down Florida State University professor Daniel Markel in his garage in the middle of the day. Police have suggested the scheme was sparked by a bitter divorce between the professor and his ex-wife.

Garcia has pleaded not guilty.

Court documents show that Rivera's plea deal -- which lessened his charge from first-degree murder and a possible death sentence -- require him to cooperate fully with authorities. The Tallahassee Democrat reported that Rivera is already cooperating with authorities and that his involvement led to the arrest this past weekend of a third suspect, Katherine Magbanua. Detectives allege that Magbanua has ties both to the family of the victim's ex-wife and Garcia.

Assistant State Attorney Georgia Cappleman said in court that Rivera's cooperation was "necessary to hold everyone accountable who is involved in this crime."

But a lawyer for Charles Adleson, the brother of Markel's ex-wife, immediately criticized the plea deal as "offensive."

"The prosecution admittedly didn't have enough evidence so it went out and bought some by giving away the farm to a murderer," David Oscar Markus said in an email. "This convicted gangster knows the game and would have said anything not to come out of prison in a box. The prosecution literally threatened him with the needle to get this testimony. That's not a search for the truth. That's a deal with the devil."

Markel, who is originally from Toronto, was well known in national and international law circles. His marriage to fellow attorney Wendi Adelson, made the pages of The New York Times in 2006. Wendi Adelson's father and brother run a well-established dental practice in South Florida. She now works for a federal judge in Miami.

Markel and his wife divorced in 2013, but before it was finalized the two fought over Wendi Adelson's push to move her two small children to South Florida to be closer to her family, court records show. At the time of Markel's death, the two were battling over money, with Adelson contending that Markel did not pay her as much as he was supposed to under their divorce agreement. Markel also complained that his mother-in-law was disparaging him and wanted the court to prohibit her from having unsupervised visits with his children.

Rivera and Garcia were arrested last June after police say they connected a rented Toyota Prius to the pair. Detectives say toll booth and other evidence shows the Prius was driven to Tallahassee from South Florida and back right before and after the killing and that video from a Tallahassee ATM shows the pair sitting in a Prius. They say video shows a Prius tailing Markel home from the gym just before he was shot and a neighbor saw one driving away immediately after the shooting.

At the time of the charges were filed, Rivera was already serving a 12-year sentence on racketeering charges stemming from his leadership role in the Latin Kings street gang.

In documents released by police, detectives alleged that Magbanua had a romantic relationship with Charles Adelson. Investigators say in the weeks leading up to the killing and immediately thereafter, there were hundreds of calls between Charles Adelson and Magbanua and between Magbanua and Garcia, often moments apart.

The documents allege that shortly after the killing, Garcia bought two cars and a motorcycle and Rivera, bought a motorcycle.

The documents also say that the Adelsons' dental practice paid Magbanua numerous $407.58 checks between September 2014 and last January, though she allegedly never worked there. They also say that in the months leading up to the killing, she deposited $15,000 cash and then after the killing deposited more than $56,000. They say she also obtained a 2001 Lexus from the family and in a monitored phone call last April, police say she asked Charles Adelson for his Ferrari or his boat and mentioned she wanted an Escalade.

Wendi Adelson and her family have denied any involvement in the killing.