A South Korean soldier threw a grenade at his commander and then opened fire on his fellow soldiers Sunday near the border with communist North Korea (search), killing eight and injuring two others, the Defense Ministry said.

Kim Dong-min, 22, told military investigators he threw the grenade in an army barracks packed with sleeping soldiers out of anger when he saw a senior soldier who had often yelled at him, according to Army spokesman Chang Suk-gyu.

Five soldiers died in the explosion. Another three were killed when Kim then took a rifle from a fellow soldier and opened fire, the spokesman said. Kim fired some 40 shots, according to South Korea's Yonhap news agency.

Two other soldiers were treated at a nearby hospital, but they were likely to survive the injuries, Chang said. A total of 25 soldiers were sleeping in the barracks at the time.

South Korea's Defense Minister Yoon Kwang-ung issued an apology, and the army said it would conduct a close inspection of all units to prevent such incidents happening again. "I extend my deep apology to the bereaved families and to the people," Yoon said in a statement.

Most South Korean men are obliged to serve for about 26 months in the military. The draft is seen as crucial to South Korea's defense against the North.