A standoff with a South Korean soldier who killed five of his comrades has ended after he shot and wounded himself with his rifle, military officials have said.

The 22-year-old, whose name was given as "Sergeant Lim" by a military official, was being treated in hospital on Monday, days after he launched a gun and grenade attack on Saturday at a border post near the Demilitarized Zone beween North Korea.

"At around 2:55pm (5:55pm GMT), Sergeant Lim harmed himself in his side with a K-2 rifle and was sent to the hospital," the military official said.

The soldier had been tracked to a densely wooded area near a small town in Goseong County and troops were trying to negotiate his surrender.

Speaking from Seoul, Al Jazeera's Harry Fawcett said the soldier, a conscript, injured himself in the torso, and was now being held at the same hospital where some of those who survived his attack were being treated.

Lim was three months away from the end of his mandatory two-year national service. Fawcett reported that his father and his elder brother were apparently both on the scene when he shot himself.

Fawcett said Lim "was under observation for having allegedly failed to adapt to military life, and was at one point given a category A risk assessment".

"That assessment was downgraded in November, and that's why he had access to live ammunition and grenades."

Source: Al Jazeera and agencies