SEOUL, South Korea — A fugitive labor leader who had taken refuge in a well-known Buddhist temple surrendered to the authorities on Thursday, ending a 24-day standoff that had set off a rare police raid within the temple complex.

The leader, Han Sang-gyun, of the Korean Confederation of Trade Unions, had been at the Jogye Temple in central Seoul since Nov. 14, when he helped organize a rally nearby that drew tens of thousands of people. That antigovernment demonstration, the largest since President Park Geun-hye took office in 2013, turned violent, with some protesters wielding metal pipes and the police using water cannons and tear gas. Dozens of people were injured.

Since then, the Jogye Temple, which is the headquarters of South Korea’s largest Buddhist denomination, had come to resemble an urban fortress under siege as the monks denied entry to the police, who sought to arrest Mr. Han on charges related to the Nov. 14 protest and previous ones. The police erected barricades and screened people passing through the temple gates, and rival groups of Buddhists shouted and even shoved one another as they bickered over whether their temple should give Mr. Han refuge.

On Thursday, a day after the police finally entered the temple grounds and surrounded the building where Mr. Han was staying, the labor leader turned himself in.