San Francisco police spokesman Gordon Shyy says officers found the man near the Caltrain station at 22nd street Monday.
Shyy says the man was defiant and climbed onto a ledge above train tracks. Police negotiators eventually convinced him to surrender.
Caltrain was shut down in both directions for nearly two hours, leaving droves of commuters stuck in the city and keeping baseball fans from getting to AT&T Park, where the Giants were hosting the San Diego Padres.
Caltrain spokeswoman Christine Dunn says there were no passengers stranded on trains. Passengers were urged to head to other trains and buses during the standoff.