A sheriff's deputy has fatally shot a man who stormed through security at a northern California county courthouse carrying two large butcher knives.

District Attorney Larry Morse II says guards chased the man as he ran down the hallway on Monday afternoon carrying the knives and entered a courtroom holding them above his head.

Witnesses say the Merced County sheriff's deputy shot him shortly after he charged through the courtroom doors. No other injuries were immediately reported.

The courthouse remains on lockdown. A public defender says he recognized the knife-wielder as a previous client with a history of mental illness.