Portland police charged a South Portland man with drunken driving, reckless conduct and criminal threatening with a dangerous weapon Thursday morning after he crashed his car, then waved what appeared to be a black handgun.

Noor Ibrahim, 27, drove into several parked vehicles on Oxford Street at 9 a.m., police said. A witness to the crash took Ibrahim’s car keys. Ibrahim then waved around what turned out to be a pellet gun, demanding his keys back.

Bystanders convinced him to put down the gun before police arrived.

Nobody was injured.

“We’re fortunate the way this case played out. Nobody was hurt,” said Cmdr. Gary Rogers. “This incident could have ended in a tragic situation,” he said, referring to the potential for an armed confrontation with police because Ibrahim had a gun.