Ricardo Ramirez, accused of gunning down an FBI informant in a botched 2011 drug sting, pleaded guilty Tuesday to murder just before a jury was to be selected in his capital murder trial.

The decision means the 37-year-old will be eligible for parole in 30 years. Had he gone to trial on the capital murder change, Ramirez could have faced life in prison without parole.

"What swayed him was that his wife told him she wasn't going to lie for him," said Assistant Harris County District Attorney Shannon Davis.

Ramirez was convicted of killing 53-year-old Lawrence Chapa in a daytime shootout in northwest Harris County on Nov. 21, 2011.

Chapa was shot at least eight times by at least two gunmen after the 18-wheeler "bait truck" full of marijuana was stopped by three SUVs of drug cartel gunmen.

Mario Madrid, Ramirez's attorney, said several witnesses were expected to testify that Ramirez was at the ambush because he was under duress. According to Madrid, Ramirez owed a debt to smugglers who had helped him come to America.

The attorney said that when those witnesses changed their minds on the eve of trial, Ramirez decided to plea to the lesser charge of murder.

Madrid said he did not expect Ramirez's wife to lie, but said her expected testimony changed before trial.

Madrid said Ramirez took the plea deal instead of facing life in prison without parole.

"The plea gives him a chance to one day walk out of prison," Madrid said. "It's a just plea. It's fair."

Four other men, Alfredo Gomez, 21; Eric Deluna, 25; Rolando Resendiz, 30; and Fernando Tavera, 21, also are charged in the informant shooting.

Each faces an automatic sentence of life in prison if convicted of capital murder. Their trials are scheduled to begin next month.