A woman was taken into custody Sunday in San Diego after police said she pointed a weapon at officers not far from the finish line of the city's marathon, leading to a frightening scene for runners and spectators.

Officials said that just before 11 a.m., police received a report of a hit-and-run near the 2018 Rock 'n' Roll Marathon downtown. Once an officer approached the driver of the suspected vehicle, she pointed a handgun at the cop who stepped away and called for help, police said.

The suspect, identified by the San Diego Police Department as 58-year-old Mona Elease Williams, drove into a parking garage and left her vehicle with the handgun, according to investigators. A responding officer fired a shot Williams and missed.

Williams, police said, tossed her gun from the parking garage and surrendered.

"There's no longer a threat to the community," the department tweeted after the incident on Sunady. "The scene is secure. The Rock and Roll Marathon has resumed."

During the encounter, an officer accidentally shot himself in the leg, but police Chief David Nisleit said he's expected to make a full recovery.

The police chief said the department also was investigating whether the woman was connected to a kidnapping in Chula Vista, roughly 10 miles south of San Diego.

Spectators described on Twitter hearing at least one shot fired near the finish line of the marathon. The incident halted the event for roughly 30 minutes as officials investigated, police said.

The Associated Press contributed to this report.