Updated

A Mexican national at the center of a national immigration controversy pleaded not guilty to murder charges Tuesday as lawmakers voiced criticism over the way he was released before being accused of shooting a woman at a popular city pier.

Juan Francisco Lopez Sanchez is charged with first-degree murder in last week's shooting of Kathryn Steinle, 32, while she was walking with her father.

The shooting sparked national debate because Sanchez is in the United States illegally and was recently released from San Francisco's jail despite federal authorities' request that he remain in custody so deportation proceedings could begin. The San Francisco sheriff says a local law requires him to ignore U.S. Immigration and Customs Enforcement "detainer requests," a position that is drawing criticism from a wide range of politicians and others.

Sanchez was deported five times previously and has spent a combined 17 years in federal prison for illegal entry into the United States.

Sanchez was transferred to San Francisco to face a 20-year-old marijuana possession charge after completing his latest prison sentence. Sanchez was freed from jail after the district attorney dropped charges in April because the case was too old to prosecute.

Hillary Clinton, a Democratic candidate for president, told CNN Tuesday that San Francisco was wrong to ignore ICE's detainer request.

"The city made a mistake, not to deport someone that the federal government strongly felt should be deported," Clinton said. "So I have absolutely no support for a city that ignores the strong evidence that should be acted on."

Republicans also criticized Sanchez's release.

"He had a criminal warrant but was released into the general society to commit a murder. Does that make any sense to you?" Sen. Ron Johnson, R-Wis., who chairs the Senate's homeland security committee, demanded to know at a hearing. "Because I'll tell you it doesn't make any sense to the American public."

San Francisco Sheriff Ross Mirkarimi defended Sanchez's release from jail and the city's law requiring it to ignore ICE detainer requests. The sheriff said ICE could have obtained a warrant or court order to keep Sanchez in custody.

"ICE knew where he was," Mirkarimi said in an interview Monday. The sheriff said he will continue to ignore ICE detainer requests and that federal officials can easily obtain court orders to keep people targeted for deportation in custody.

State Sen. Jeff Stone, R-Temecula, said he would introduce legislation in Sacramento to require cities to comply with ICE detainer requests.

In court Tuesday, Sanchez's public defender, Matt Gonzalez, said the shooting appeared to be an accident. In jailhouse interviews with two television stations, Sanchez said he found a gun wrapped in a shirt on the pier Wednesday evening. He said the gun went off in his hands.

"This was an act of random violence, shooting an innocent victim in the back," prosecutor Dianna Garcia told the judge, arguing against releasing Sanchez on bail.

The judge set bail at $5 million, which Gonzalez said will keep Sanchez jailed pending trial.

A downcast Sanchez spent most of the hearing with his head bowed, appearing to fight back tears while the judge explained the charges to him. Sanchez was aided by a Spanish-language interpreter and pleaded not guilty in Spanish.

Outside court, his attorney said Sanchez has a second-grade education and a nonviolent criminal record of low-level drug arrests and immigration violations.

He faces life in prison if convicted.