South Korean investigators attempted to detain impeached President Yoon Suk Yeol over his short-lived martial law decree last month, as hundreds of his supporters gathered near his residence in Seoul, vowing to protect him.

About 20 investigators from the Corruption Investigation Office for High-Ranking Officials and police officers were seen entering the gate of Mr Yoon’s residence in Seoul to execute a warrant for his detention.

It was not clear whether the president would co-operate with authorities trying to detain him.

In a defiant new year’s message to conservative supporters rallying outside his residence, the president said he would “fight to the end” against “anti-state forces.”

His lawyers have described the warrant to detain him as “invalid” and “illegal.”

Supporters of impeached South Korean President Yoon Suk Yeol stage a rally to oppose a court warrant to detain him (Lee Jin-man/AP)

The anti-corruption agency did not immediately confirm whether investigators successfully entered Yoon’s residential building. South Korea’s YTN television reported that there were scuffles as investigators and police confronted the presidential security forces.

Investigators from the anti-corruption agency were earlier seen loading boxes into several vehicles before leaving their building in the city of Gwacheon early in the morning. Television footage later showed some of those vehicles weaving between police buses that tightly packed and barricaded the streets near Mr Yoon’s residence.

A Seoul court issued a warrant for Mr Yoon’s detention on Tuesday after he evaded multiple requests to appear for questioning and blocked searches of his office in Seoul, hindering an investigation into whether his ill-conceived power grab on December 3 amounted to rebellion.

The warrant is valid for one week and investigators may make another attempt to detain Yoon if they are unable to do so on Friday.

Thousands of police officers were gathered at Mr Yoon’s residence and were forming a perimeter around a growing number of pro-Yoon protesters, who waved South Korean flags and shouted slogans in his support. There were no immediate reports of clashes.

If Mr Yoon is detained, the anti-corruption agency will have 48 hours to investigate him and either request a warrant for his formal arrest or release him.

Mr Yoon’s defence minister, police chief and several top military commanders have already been arrested over their roles in the martial law enactment.

South Korea’s President Yoon Suk Yeol (South Korean Presidential Office/AP)

The president’s lawyers have argued the court’s detainment warrant is invalid, claiming that the anti-corruption agency lacks the legal authority to investigate rebellion charges.

They also accuse the court of bypassing a law that says locations potentially linked to military secrets cannot be seized or searched without the consent of the person in charge.

Yoon Kap-keun, one of Mr Yoon’s lawyers, described the investigators’ efforts to detain the president as illegal and said they would plan to pursue unspecified legal steps against the anti-corruption agency.

Oh Dong-woon, the anti-corruption agency’s chief prosecutor, has indicated that police forces might be deployed if the presidential security service resists detention.

But Mr Yoon’s legal team issued a statement on Thursday warning that any attempt by the anti-corruption agency to use police units for his detention would exceed their legal authority. The lawyers said police officers could face arrest by either the “presidential security service or any citizens” if they try to detain Mr Yoon.

South Korean law permits anyone to make an arrest to stop an active crime and critics accused Mr Yoon of inciting his supporters to obstruct attempts to detain him.

Vehicles, right, carrying investigators from the Corruption Investigation Office for High-ranking Officials arrive at the gate of the presidential residence (Lee Jin-man/AP)

Yoon Kap-keun, the president’s lawyer, filed a challenge with the Seoul Western District Court on Thursday to block both the detention warrant and a related search warrant for his residence. The lawyer argued that both warrants violate criminal laws and the constitution.

The liberal opposition Democratic Party, which drove the legislative vote that impeached Yoon Suk Yeol on December 14 over his imposition of martial law, accused the president of trying to mobilise his supporters to block his detention and called for law enforcement authorities to execute the warrant immediately.

Braving subfreezing temperatures, thousands of supporters rallied for hours near his residence on Thursday amid a heavy police presence, waving South Korean and American flags while chanting, “Nullify the impeachment!” and “We will protect President Yoon Suk Yeol!” Officers removed some protesters who laid down on a road leading to the entrance of Yoon’s residence, but there were no immediate reports of major clashes.

Yoon’s presidential powers were suspended following a National Assembly vote to impeach him on December 14 over his imposition of martial law, which lasted only hours but has triggered weeks of political turmoil, halted high-level diplomacy and rattled financial markets.

Mr Yoon’s fate now lies with the Constitutional Court, which has begun deliberations on whether to uphold the impeachment and formally remove Yoon from office or reinstate him.

To formally end Yoon’s presidency, at least six justices on the nine-member Constitutional Court must vote in favour.