Image copyright Getty Images Image caption The Rock 'n' Roll Marathon resumed after the suspect was detained

An "active shooter" has been arrested after allegedly opening fire near the finishing line of a marathon race in California, US media and police say.

San Diego police said the shooter was in custody, the scene was secure and the Rock 'n' Roll Marathon had resumed.

Media reports said the shooter was a woman who had fired from an upper floor of a parking garage.

Some reports said a police officer had shot himself in the foot by accident but this has not been confirmed.

Other media reports said the woman was firing an air pistol and at times holding the gun in her mouth.

No other injuries have been reported.

The local Fox outlet said the firing had frightened scores of runners near the finishing line as the marathon was winding down.

The organisers of the race said in a statement: "The situation involving an active shooter who was engaged with law enforcement was not related to today's race.

"By 11:45 (18:45 GMT), the course was shut down and approximately 4,900 athletes were rerouted into a designated safe zone.

"While the race was officially stopped, law enforcement gave the clearance at 11:56 for runners to resume their progress toward the finish line and the post-race finish area, where they were able to meet up with family and friends."

In April 2013, three people were killed and more than 260 injured when bombs exploded at the finishing line of the Boston marathon.