A photo published Wednesday in British tabloid the Sun shows the boy-band singer standing on the ledge of a high-rise with a city that appears to be London behind him.
The 20-year-old said in a statement that "I regret being there and having a photo taken. It was a stupid and irresponsible thing to do."
He urged fans not to imitate his "extremely dangerous" behavior.
The band emerged from Simon Cowell's British TV series "The X Factor" in 2010 and became one of the world's top-selling groups, with three albums topping U.S. music charts.