SAN JOSE — After an hours-long standoff that caused massive traffic backups, a man who had been standing on a highway overpass was taken into custody Monday evening, authorities said.

The man, who officials said had a knife, had perched himself on the highest overcrossing of the Interstate 680-Highway 101 connector, causing traffic congestion on highways that spilled over onto downtown streets for several hours Monday.

The report of the male pedestrian on the roadway was called in just before 1 p.m. at the apex of the connector linking the southbound lanes of I-680 and Highway 101, according to the California Highway Patrol.

For several hours, a negotiator was on scene trying to talk the man down, according to CHP Officer Ross Lee. The man, who alternated between sitting and standing on the ledge, waved a knife at officers who attempted to come closer to help him down. Relatives stood on a lower ramp also attempting to coax the man down, Lee added.

The man was on a more than 100-foot-high segment that overlooks the northbound connector between Highway 101 and Interstate 280. Lee added that the man appeared to be holding a knife.

Lee said that just before 7:30 p.m. the man was taken into custody by CHP officers. According to Lee, the man was arrested on suspicion of criminal threats, brandishing a weapon and trespassing on the freeway.

Both directions of I-280 and I-680 were closed at the junction at Highway 101 during the ordeal, but shortly after 7:30 p.m., all traffic lanes were reopened and cars were moving slowly onward again. CHP officials said commuters could expect residual delays well into the evening.