He almost got away with it.

Gerardo Adan Cazarez Valenzuela, a former Alaska bank employee, was sentenced Monday to 10 years in federal prison for crimes related to a 2011 bank heist that included a private jet, AK-47, a vault timer and a fake ice cream social event to be used as a diversion, authorities said.

The crime took planning. Valenzuela, cash vault services manager at a KeyBank in Anchorage, stole $30,000 from the vault prior to the heist to rent a private jet that would fly him from Alaska to Seattle.

On the day of the heist in July 2011, Valenzuela told his supervisor he was staying late to organize an ice cream social for bank customers, authorities said. Instead, he took the cash inside the vault and boarded the private plane to Seattle.

He set the timer on the vault to lock for six days to give him enough time to leave the country, prosecutors said in a statement.

In Seattle, Valenzuela, 34, bought a car and AK-47 rifle and drove with his girlfriend to Mexico. Their destination was his uncle's home in the Mexican state of Sonora. During a random search by Mexican authorities on Aug. 2, the rifle, ammunition and $3.8 million in cash were found.

CLICK HERE TO GET THE FOX NEWS APP

Valenzuela was not given any credit for the time he served in Mexico after his conviction for smuggling cash, guns and ammunition during his getaway, U.S. prosecutors said. He was extradited to Alaska last year and pleaded guilty to the bank theft in January.

Valenzuela stashed $500,000 in Washington but the money has never been recovered, authorities said.

The Associated Press contributed to this report.