SAN FRANCISCO - The shot that killed a young San Francisco woman and touched off a heated immigration debate ricocheted off pavement before striking her in the back, which defense attorneys say show the killing was an accident.

But San Francisco police inspector John Evans testified the bullet traveled in a straight line, suggesting Juan Francisco Lopez-Sanchez was pointing the gun in the direction of Kathryn Steinle, 32.

The competing versions of the same event emerged Wednesday during the second day of a preliminary hearing held to determine if there's enough evidence for Lopez-Sanchez to stand trial on murder charges. A third day of testimony is expected Thursday. A judge will rule later.

Get Breaking News Delivered to Your Inbox

Evans testified Wednesday that investigators found a spot on Pier 14 where a bullet left a mark on July 1 before striking Steinle in the back as she walked with her father. San Francisco medical examiner Michael Hunter also testified Wednesday that the bullet made a rectangular-shaped wound rather than a typical oval-shaped wound, indicating too that the bullet had ricocheted before striking Steinle.

Nonetheless, prosecutors have charged Lopez-Sanchez with intentionally firing at Steinle.

Sanchez told police he fired the fatal bullet, but called the incident an accident, according to his lawyer Matt Gonzalez and court testimony.

Lopez-Sanchez said he found the Sig Sauer .40-caliber pistol wrapped in a T-shirt under a bench on San Francisco's Pier 14. The gun belonged to a Bureau of Land Management ranger, who reported that his service weapon was stolen from his car in downtown San Francisco in June.

Divers plucked the gun from San Francisco Bay next to the pier the day after the shooting.

San Francisco Police ballistics expert Andy Smith testified that the gun was in good, working condition and that the weapon probably didn't malfunction.

"Pulling the trigger, however that trigger was pulled, was the only way for that gun to discharge," Smith said. "This gun could not just be sitting on a table and all of a sudden, due to some malfunction, go off."

Gonzalez suggested that his client "mishandled" the gun, which needs about five pounds of pressure to pull the trigger and successfully fire.

Gonzalez said he plans to call a gun expert to the witness stand Thursday to testify about accidental shootings involving the gun Lopez-Sanchez fired.

San Francisco and other cities and counties ignore requests from federal authorities to detain jail inmates who are thought to be in the country illegally.

San Francisco Sheriff Ross Mirkarimi said he was following city law when jailers released Lopez-Sanchez after a 20-year-old marijuana possession charge was dropped. But leading politicians, including top Democrats such as California Sen. Dianne Feinstein and presidential hopeful Hillary Clinton, said Lopez-Sanchez should have been detained.