A soldier among five charged in the "thrill" killings of Afghan civilians last year pleaded guilty to a murder charge on Thursday, confessing in court that he fired a heavy machine-gun at a startled, unarmed man from 15ft away after a co-defendant threw a grenade at him.

"I knew I should have taken cover, but instead I pulled the trigger," Private 1st Class Andrew Holmes, of Boise, Idaho, told the judge.

The soldiers from Joint Base Lewis-McChord, south of Seattle, were arrested in Afghanistan last year, after prosecutors said they killed three civilians for sport during patrols in January, February and May.

Holmes, 21, was accused of directly participating in the first killing, and he was initially charged with conspiracy, premeditated murder and other charges. In a deal with prosecutors, he pleaded guilty to murder by an inherently dangerous act, possessing a finger bone from his victim, and smoking hashish.

Holmes told the judge, Lt Col Kwasi Hawks, at the court in Joint Base Lewis-McChord, that one of the ringleaders of the plot, then-Cpl Jeremy Morlock, had frequently talked about killing civilians and suggested ways they could do it. As they left on patrol on 15 January 2010, Morlock told Holmes to grab an illicitly obtained grenade out of his tent because "something might happen" – and Holmes complied: "I didn't know what was going to happen, but I had a terrible feeling that Cpl Morlock was up to no good."

Later, as they patrolled a village in Kandahar, Morlock stood by a low wall along a field and called for Holmes. It was a cold day, Holmes said, and he was sweating and out of breath. He said he saw Morlock fiddling with something out of the corner of his eye.

"I suspected it was the grenade, but I was hoping it was his radio," he said.

The grenade it was. Morlock tossed it at a young man standing near the other side of the wall – even though the man was obviously unarmed and posed no threat, Holmes said. Then, he ordered Holmes to shoot.

"I looked at the young man. He was standing there like a deer in the headlights," Holmes told the judge in a clear, steady voice. "I fired six to eight rounds at the man, and I've regretted it ever since."

Holmes and Morlock then posed for a photographs holding up the head of the victim. Holmes' lawyer, Dan Conway, has insisted he was ordered to pose.

Holmes was expected to be sentenced on Friday. No sentencing recommendations by prosecutors or the defence under the terms of the plea deal were immediately disclosed. Under military law, a person can be convicted of murder even if the act is not premeditated – if, for example, the actions of the defendant were taken in disregard of human life.

The charges against the five soldiers from what was formerly known as the 5th Stryker Brigade – since renamed the 2nd Stryker Brigade – are among the most serious war crimes charges to emerge from the Afghan war.

Prosecutors say that in addition to killing three men some of the defendants kept body parts severed from the corpses as well as photographs kept as war trophies. Drug use was rampant in the unit, and one soldier who blew the whistle on hash-smoking by his comrades was beaten up and threatened.

Morlock has admitted taking part in the three killings and agreed to testify against his co-defendants in exchange for a 24-year sentence. Staff Sgt Calvin Gibbs of Billings, Montana, is the highest ranking soldier charged in the killings, and Morlock and others said he was the mastermind. Gibbs denies wrongdoing.

Spc Adam Winfield of Cape Coral, Florida, told his parents about the plot in Facebook messages after the first killing, and his father immediately reported it to Lewis-McChord. But the alert was not reported up the chain of command, and the plot did not come to light until months later, when two more victims had been killed.

Winfield admitted participating in the last killing, saying he thought Gibbs might kill him if he didn't, and he pleaded guilty this summer to involuntary manslaughter and was sentenced to three years.

Holmes also pleaded guilty to drug use and keeping a finger bone severed from a corpse. He told the judge Gibbs gave him the finger, and he took it only because Gibbs insisted.

Conway said it was a "tough pill to swallow" for Holmes to plead guilty to murder, but prosecutors would not agree to the lesser charge of involuntary manslaughter.

He blamed Holmes' troubles on the unluckiness of being assigned to a unit with Morlock.

"Andy Holmes joined the army as a healthy, good-natured, 18-year-old kid who liked to play golf and go fishing," Conway said after the hearing on Thursday. "He may be leaving the army as a felon."