A man accused of shooting and wounding a Miami Gardens police officer claimed in a court appearance Saturday that he fired on the officer because he felt his life was in danger.

David Andres Mejia, 24, was arrested on Friday after Miami Gardens Police Chief Antonio Brooklen said he “ambushed” a police officer early Friday morning, shooting multiple times and wounding him.

Mejia lashed out at the judge in court Saturday after he heard he was being held without bond, Local 10 News reports.

"How does a kid who shot a church get a bond, but I can't get a bond, man?" Mejia asked the judge. “I practice my Second Amendment. My life was in danger by crooked cops.”

>> Read more Floridoh stories

Miami Gardens officer David Starling, 52, was reportedly filing an accident report in his patrol vehicle when authorities say Mejia drove by and shot at him eight times. Starling was sent to the hospital for a gunshot wound to the leg, but was reported to be in good condition.

Mejia led officers on a car chase after he shot at Starling, and authorities say he fired at officers during the chase.

Mejia faces numerous charges, such as five counts of attempted first-degree murder with a deadly weapon, use of a firearm in commission of a felony, and aggravated fleeing, according to WSVN.

Read more at local10.com