Costa Mesa police arrested a man suspected of robbing a Huntington Beach resident at gunpoint Saturday as he deposited money into an ATM.

After being chased by the mace-wielding victim and searched for by a helicopter and K9 units, the suspect turned himself in, according to police.

Brian Gonzalez, 18, of Fontana, approached a 29-year-old man who was depositing money at a Wescom Credit Union ATM on Baker Street near Fairview Road about 11:10 p.m., police said.

Gonzalez, wearing a hooded sweatshirt, brandished a short-barreled shotgun and told the victim to withdraw cash, according to police.

Police said the victim entered his PIN and then ran back to his vehicle, where he grabbed a canister of mace and chased Gonzalez, spraying it in his direction as he ran from the ATM. 

He lost Gonzalez after about a block and called police, according to a release from the department.

Costa Mesa police officers, an Orange County Sheriff's Department helicopter and K9 units from the Newport Beach and Cypress police departments started a search for the suspect.

As they looked, Costa Mesa police got a call from one of the suspect's family members, according to the release.

Police said Gonzalez had called asking for a ride because police were chasing him, and the family member instead called the authorities.

Police were able to contact Gonzalez on his cell phone and convince him to surrender at a fast-food restaurant at 15th Street and Newport Boulevard in Costa Mesa.

Officers found a shotgun by a dumpster at an apartment complex near Coolidge Avenue. They allege Gonzalez dumped it there. Officers also recovered $20.

Gonzalez was booked for armed robbery and transported to Orange County Jail, where he was held on $50,000 bail, police said.

Officers are trying to determine if he was involved in similar crimes and are asking anyone who thinks he or she may be a victim to contact Det. Rob Hanson at (714) 754-5162.

jeremiah.dobruck2@latimes.com

Twitter: @jeremiahdobruck