Authorities took a man into custody Friday evening after he forced an hours-long shutdown of the Golden State (5) Freeway in East LA during rush hour as he stood on the railing of a freeway overpass.

The freeway was shut down for more than three hours at Olympic Boulevard as crews were attending to the man, said California Highway Patrol Officer Alex Rubio.

At the foot of the overpass, firefighters inflated a giant mattress, called a rescue air cushions, under where the man stood at the edge of a railing behind a sign for the Long Beach (710) Freeway transition.

Video from the scene showed the man struggling with crews as they tried to get him to surrender behind one of the freeway signs.

He was taken into custody by about 7 p.m. and placed on a mental health hold, officials said. Both sides of the 5 Freeway reopened by 7:30 p.m.

Traffic was diverted off the freeway during the closure and some drivers got out of their cars to take a look.