The MS-13 gang members had been lying in wait, prosecutors said. They had been threatening their target persistently, but he wouldn’t give in, so the gang members decided he had to go.

For 10 minutes, gang members stalked the outside of a Chillum, Md., apartment before the man they were looking for finally returned home around 3 a.m. on April 17, 2016, with a group of friends from a nightclub, prosecutors said.

At least one gang member shot the intended victim at least a half-dozen times before he collapsed to the ground, prosecutors said. The target survived, but a friend, Gamaliel Nerio Rico, 25, was fatally shot.

Three years after the shooting prosecutors say was “all for the glorification” of MS-13, Fernando Baires, 21, was sentenced Friday to life in prison.

“They really just that night went out to have a good time,” Judge Beverly J. Woodard of the Prince George’s County Circuit Court said of the victims. Nerio Rico “really was innocent in all of this.”

Baires, who was 17 at the time of the shooting but charged as an adult, was convicted of murder, attempted murder and participation in a gang resulting in death. At his sentencing, Baires, his attorney and his family maintained that he was innocent and that his arrest was a case of mistaken identity.

“I hope that God’s help will bring me back home as soon as possible with my family,” Baires said.

Baires’s attorney, Keith Parris, said for three years his client has been unwavering in his innocence. Parris questioned the reliability of some of the information presented to jurors, saying the other victim was hospitalized and medicated when he identified Baires as one of his attackers.

A co-defendant in the case, Darwin Naum Monroy Madrid, was also sentenced to life in prison in October 2017, according to online court records. Madrid was 16 at the time and charged as an adult.

“My client was very young and testified truthfully, and there are very significant issues that are up on appeal right now,” said Madrid’s attorney Kathleen Dolan.

Dolan said her client testified that he feared he would be killed if he did not participate in the attack. Dolan said she had planned a “duress defense” for her client, but the judge would not allow her to move forward with it. Dolan said she is appealing the case.

“If we had gotten that, a whole bunch of things for the trial might have been different,” Dolan said. “He was so fearful he was going to get killed.”

Prince George’s County Assistant State’s Attorney Cynthia Bridgford said the victim being targeted had affiliations with a rival gang in his home country but put all of that behind him when he came to the United States. When MS-13 found out about his past, Bridgford said, “he had been threatened” repeatedly and “he stood up for himself.” Bridgford said neither of the victims had been involved in any gang activity in the United States.

Prince George’s County State’s Attorney Aisha N. Braveboy said the surviving victim still fears the gang will come after him and is unable to sleep and work as he did before suffering the physical and mental trauma of the shooting. The man who died, Braveboy added, left behind a life of potential.

“He will never have a family of his own,” Braveboy said. “He will never grow up and grow old with his siblings and his other relatives because cowards viciously gunned him down.