BAKERSFIELD, Calif. (AP) — Authorities have arrested a man who posted messages on Facebook while surrounded by SWAT teams after a five-hour standoff in Bakersfield.

KBAK-TV reports the incident began Tuesday morning when California Highway Patrol officers and U.S. Marshals tried to serve a warrant for a weapons-related charge.

READ MORE: Pilot, Pregnant Wife And Young Nephews Survive Plane Crash In Wilton

Authorities say Darren Aldridge had fired several shots and barricaded himself inside a trailer. Two women who had also been inside were able to exit safely during the standoff.

While inside the trailer, Aldridge went on Facebook, posting messages that said “Bring the feds!!!!!” and “I’m gonna live as long as I can.”

READ MORE: Statewide School Walkout In The Works Over Gov. Newsom's Vaccine Mandate

Aldridge eventually surrendered and was taken into custody.

Authorities say the bomb squad detonated a possible explosive device found in the trailer.

MORE NEWS: Inmates Credited With Saving Folsom Prison Guard Who Suffered Heart Attack

Copyright 2015 The Associated Press.