BAKERSFIELD, Calif. (KGET) — The man who climbed to the roof of a downtown business and swung a machete while allegedly threatening police during an hours-long standoff pleaded not guilty Friday to a dozen charges.

Raymond Valenzuela, 44, was ordered held on $300,000 bail after Court Commissioner Roger. H. Ponce Jr. found he posed a danger to the public. Valenzuela’s next hearing is scheduled May 18.

KGET cameras on Wednesday showed Valenzuela atop the Mercy Plaza Pharmacy on Eye Street. An employee who arrived to work at 8:40 a.m. said Valenzuela threw rocks from the building. Cameras caught him swinging a machete and striking parts of the roof.

The building was evacuated.

Police said Valenzuela made threats to officers and threatened to harm himself. They spent hours trying to get him to come down.

Valenzuela surrendered at about 12:20 p.m., police said.

Prosecutors filed charges including assault with a deadly weapon other than a firearm against a peace officer, vandalism, brandishing a firearm or other deadly weapon to avoid arrest and several counts related to resisting arrest and drug-related offenses.