HOUSTON -- Convicted ex-Enron Corp. CEO Jeffrey Skilling's more than 24-year prison sentence for his role in the once mighty energy giant's collapse could be trimmed by as many as 10 years if a federal judge approves an agreement reached Wednesday between prosecutors and defense attorneys.

Under the agreement, Skilling's original sentence will be reduced to somewhere between 14 and 17.5 years.

The agreement still has to be approved by U.S. District Judge Sim Lake, who is set to hold a June 21 hearing in Houston to make the final decision on the length of Skilling's sentence.

Daniel Petrocelli, Skilling's attorney, says the agreement "brings certainty and finality to a long, painful process."

Justice Department spokesman Peter Carr said the agreement will allow victims of Enron's collapse to finally receive more than $40 million in restitution. The ongoing status of the case has so far prevented the government from distributing Skilling's seized assets to victims, according to the agreement.

Skilling's sentence already was set to be reduced.

Skilling was convicted in 2006 on 19 counts of conspiracy, securities fraud, insider trading and lying to auditors for his role in the downfall of Houston-based Enron. The company collapsed into bankruptcy in 2001 under the weight of years of illicit business deals and accounting tricks.

Skilling has been in prison since December 2006 and is serving his sentence in a low security facility outside Denver.

An appeals court in 2009 upheld his convictions but vacated his more than 24-year prison term and ordered that he be resentenced, saying a sentencing guideline was improperly applied, resulting in a longer prison term.

The U.S. Supreme Court said in 2010 that one of his convictions was flawed when it sharply curtailed the use of the "honest services" fraud law - a short addendum to the federal mail and wire fraud statute that makes it illegal to scheme to deprive investors of "the intangible right to honest services."

The Supreme Court ruled that prosecutors can use the law only in cases where evidence shows the defendant accepted bribes or kickbacks and that because Skilling's misconduct entailed no such things, he did not conspire to commit honest-services fraud.

The Supreme Court told a lower court to decide whether Skilling deserved an entirely new trial. The lower court said no.

Skilling, 59, was the highest-ranking executive to be punished for Enron's downfall. Enron founder Kenneth Lay's similar convictions were vacated after he died of heart disease less than two months after trial.

Enron's collapse put more than 5,000 people out of work, wiped out more than $2 billion in employee pensions and rendered worthless $60 billion in Enron stock. Its aftershocks were felt across the city and the energy industry.