BANGKOK -- Thai police on Wednesday detained a senior police officer who fired multiple gunshots from his home in Bangkok, ending a standoff of over 24 hours after his colleagues tried to take him to a mental institution.

The gunman, identified as police Lt. Col. Kitikarn Sangbun, was taken to a hospital Wednesday for an injury after the ordeal, said police Lt. Gen. Samran Nualma, an assistant to the police chief. He did not specify the nature of Kitikarn's injury and how it was incurred, but said no others were hurt.

Video posted on Twitter by the newspaper Khaosod showed the end of the incident as Kitikarn, clad in shorts and a T-shirt and clutching a carving knife in his left hand, smashed through a second-story window and leaped down into a small, cluttered backyard. He lay dazed for several seconds until police in full tactical gear rushed out from the house's back door, seizing him roughly.

The incident began Tuesday morning when Kitikarn's superior officer was going to take him to be treated at a mental institution, but was rebuffed, said police Col. Rangsan Sornsing, superintendent of Sai Mai police station in Bangkok. Police gave no further details on why they were picking the man up for treatment.

Kitikarn then fired in the direction of police who arrived at the scene. Officers evacuated and cordoned off the surrounding area as they tried several methods to apprehend him.

Police fired tear gas Tuesday night and Kitikarn reportedly responded by firing a salvo of bullets. On Wednesday morning, a junior officer sang songs for Kitikarn in an attempt to calm him down, intermittently asking him to turn himself in.

A self-described Rishi, a traditional Asian hermit healer, arrived at the scene Tuesday night and declared that the gunman was possessed. He said he would be able to solve the situation if he was allowed to meet the officer, the crime news website Ejan reported, but police did not allow a meeting due to safety concerns. The situation gathered national interest with the hashtag "crazed inspector" trending on Twitter in Thailand.

At one point a bullet grazed but failed to penetrate the helmet of one officer at the standoff, the government's National News Bureau of Thailand said in a Twitter post.

Thailand's deadliest massacre took place last year when a former police officer shot and slashed to death 36 people at a daycare center. The country's previous worst mass killing involved a disgruntled soldier who opened fire in and around a mall in the northeastern city of Nakhon Ratchasima in 2020, killing 29 people and holding off security forces for some 16 hours before eventually being killed by them.

Mass shootings are rare but not unheard of in Thailand, which has one of the highest civilian gun ownership rates in Asia with 15.1 weapons per 100 people compared to only 0.3 in Singapore and 0.25 in Japan. That's still far lower than the United States rate of 120.5 per 100 people, according to a 2017 survey by Australia's GunPolicy.org nonprofit organization.