The FBI, ending a sting, says it has arrested a California man after he tried to set off what he thought was a car bomb at a bank in Oakland.

Matthew Aaron Llaneza, 28, of San Jose, was arrested Friday morning, capping a months-long undercover investigation, the Justice Department said. Agents say he met last November with someone he thought was connected with the Taliban but who was actually an FBI agent.

Prosecutors say Llaneza proposed car-bombing a bank in the San Francisco Bay Area.

"Llaneza's stated goal was to trigger a governmental crackdown, which he expected would trigger a right-wing counter-response against the government followed by, he hoped, civil war," the Justice Department says.

Court documents say Llaneza expressed a desire to commit violent jihad and talked about wanting to flee the U.S. after the bombing, but a federal official says his precise motive was unclear.

NBCBayArea.com reported that court documents said Llaneza suffered from bipolar disease and substance abuse.

Court documents say he chose a Bank of America branch in Oakland as the target for the attack and offered to drive the car bomb to the bank. In January and February, they say, he and the undercover agent built the supposed bomb.

Investigators say Llaneza bought two cell phones to be used in detonating the device. Thursday night, they say, he drove an SUV containing the device and parked it under an overhang on the bank building, then walked a safe distance away and tried to set it off, when he was then arrested.

The device had earlier been rendered inoperable by the FBI.

He had his initial appearance in court this morning and will be back for a bail hearing next Wednesday in Oakland.