A man who shot at an occupied building in Costa Mesa while drunk was sentenced Monday to 10 years in prison, a court official said.

Ryan Matthew Stimbert, 38, of Irvine, pleaded guilty to one felony count of attempted robbery, three felony counts of assault with a firearm, one felony count of possession of a firearm by a felon, and shooting at an occupied and unoccupied building, court records show.

Police have said Stimbert was drunk when he tried to rob the Avalon Bar on April 11, 2012, with a large handgun with a scope after he was kicked out of another bar. He left with no money, and drove about 300 feet to the 1900 block of Placentia Avenue where he shot into a building, police said at the time. He was arrested nearby.

— Lauren Williams

Twitter: @lawilliams30