The spectacle attracted a mass of spectators on the ground watching as police officers and firefighters worked to try to convince the man to come down on his own.
The crane was near Hollywood Boulevard and El Centro Avenue in Hollywood.
"So every time we thought he was going to do it and it was going to be awful, he was like, nope, just kidding. He acrobatic," said witness Amy Halloran.
Another bystander, Jenny Blumenthal, added: "You could tell he knew what he was doing, for sure."
He was wearing no shoes or shirt and appeared to be draped in an American flag. He was spotted climbing and moving around on cables above the crane and slowly descending, then stopping on a platform for more than an hour as he shouted and gestured at the ground and waved the flag.
An urban search and rescue team joined firefighters and police officers who were trying to convince the man to come down.
"He would keep rambling, saying things we didn't understand and yelling at people that weren't there," said Sgt. Jose Torres of the Los Angeles Police Department.
After about three hours, police said they had the man safely in custody on the ground. He was treated by paramedics and transported to a hospital.
According to Torres, the suspect said he wanted to talk to his family but did not indicate why he climbed the crane or carried the flag.
"He said he has a daughter," the sergeant said. "Once he came down I was able to talk to him and he said she's nine years old. He said he hasn't seen her in a while."
The man was undergoing a mental evaluation. It was unclear if he would be cited for trespassing, a misdemeanor.
A man with an American flag is climbing up and down a crane on Hollywood Blvd. LAPD and LAFD are on scene, streets between Vine and Gower are closed. It’s unknown why he’s on the crane. pic.twitter.com/wfcvhLucmd— Melissa MacBride (@abc7melissa) April 9, 2018