Crisis negotiators from the San Francisco Police Department and California Highway Patrol successfully detained a man who threatened to jump from the upper deck of the Bay Bridge Saturday afternoon.

The CHP closed the two right lanes of the upper deck while negotiators attempted to get the person to climb back onto the road deck after he climbed onto the ledge of the bridge at 2:45 p.m. The left lane of the lower deck of the bridge was also closed by the CHP, a witness told the Beat.

The closures and police activity jammed traffic on the bridge for hours, motorists said.

The man was seen on the suspension section of the Bay Bridge just past Treasure Island. Witnesses said the man stopped his car, got out and climbed over the railing of the bridge.

Negotiators from the CHP and SFPD spoke with the man for two to bring him to safety just after 4:30 p.m., authorities said. He was taken to San Francisco General Hospital for medical evaluation, according to the CHP.

The 40-year-old man was later taken into custody after officers discovered that he had been driving under the influence, a CHP spokesperson said.

The United States Coast Guard also dispatched a boat to the underside of the bridge, according to emergency radio traffic, as part of the response.