A security guard was shot and wounded in Oakland on Sunday during a robbery of a KPIX television news crew before returning fire and apparently wounding a fleeing robber.

Several people approached reporter Joe Vazquez and his crew around 5 p.m. outside a library on the 1000 block of 81st Avenue and stole the crew’s camera and tripod, Oakland Police Department spokeswoman Johnna Watson said.

The security guard was shot in the leg and taken to a hospital, according to a KPIX tweet.

Watson said the security guard, a retired law enforcement officer hired by KPIX, suffered a nonfatal gunshot wound and returned fire. Sources close to the situation said the robber was hit as many as four times as he fled.

Later, a person with gunshot wounds walked into a local hospital. Police were investigating whether that person was involved in the robbery.

Two hours after the robbery, Oakland police briefly pursued a vehicle they believe was involved in the heist. The driver was detained after crashing at the corner of 55th and Bancroft avenues.

Oakland police also said they have detained “several other individuals” and have recovered some of KPIX’s property.

Peter Fimrite is a San Francisco Chronicle staff writer. Email: pfimrite@sfchronicle.com Twitter: @pfimrite