A man recently charged with felony murder in an August 2018 home invasion was a neighbor of the victim and even attended his funeral, attorneys revealed during a hearing on Thursday.

Corey L. Grier, 21, of Woodbury, will remain in jail pending trial following his arrest last month.

Grier and Thadius W. Oswald, 19, allegedly forced their way into a Woodbury home on Aug. 11 and robbed the residents of their cellphones and cash.

One of the victims, Misael Ruiz Garcia, 32, followed one of the robbers out of the home and across the street, where prosecutors allege Oswald turned, raised a handgun and shot Ruiz Garcia in the forehead at point-blank range.

Witnesses quickly identified Oswald as the alleged shooter and he was arrested two days later.

The search for his alleged accomplice took a bit longer, Assistant Prosecutor Dana Anton explained during Thursday’s hearing.

The other two robbery victims left the state weeks after the crime and, when prosecutors recently found them in Tennessee, they helped identify Grier. The witnesses do not speak English, officials noted.

“When we interviewed them in Tennessee, they told us they were afraid to identify him because he lived across the street,” she said. “So it is only now that we found them in Tennessee that they were willing to come forward and to identify him.”

Public defender Richard O’Brien acknowledged that Grier knew Ruiz Garcia.

“He submits that he was on good terms with the victim and even went to the victim’s funeral service and had no ill-will towards any of the people involved in this,” O’Brien said.

Grier was arrested Jan. 28 on charges including murder, robbery, conspiracy, burglary and theft. He faces a maximum sentence of life in prison on the murder charge.

During a probable cause hearing held Thursday, O’Brien disputed the first-degree murder charge, arguing that Grier didn’t have a gun and didn’t know Oswald would use his firearm. O’Brien said Oswald has made statements suggesting that Ruiz Garcia took a swing at him and that the gun went off accidentally.

“Regardless, our position is it was an act solely attributable to Mr. Oswald. Mr. Grier was not present,” O’Brien said. “This, I submit, was a spontaneous action on the part of Mr. Oswald that Mr. Grier could never have contemplated.”

The pair fled in opposite directions after they left the Centre Street house, Anton said, but Grier’s participation in the robbery — something he has admitted to, she noted — makes him accountable for the killing even though he isn’t accused of pulling the trigger.

“Although Mr. Grier was not present right with Mr. Oswald when he shot the victim of the robbery, it was in the flight from the robbery that the victim tried to stop (Oswald) and Mr. Oswald turned around and shot him in the head.”

“The evidence suggests that they went into the house together, they went through the house and took items from the people that lived in the house,” Anton said.

Facebook messages between the pair days before the crime and statements Grier made to police confirm that he knew Oswald had a gun during the crime, she added.

“There are also several reports that came in earlier in the day of the murder that Mr. Grier was seen around town carrying a handgun,” Anton added, drawing a dismissive noise from Grier, who frequently conversed with his attorney during the hearing.

Superior Court Judge Kevin T. Smith reviewed the felony murder statute and found probable cause for the charge against Grier.

Arguing for pre-trial detention, Anton noted Grier’s criminal history, which includes three felony convictions for robbery, burglary and obstruction, adding that he was on pre-trial release when the killing occurred. He’s also enrolled in the state’s drug court program.

“Three felony convictions before age 21 says volumes,” Anton said. “He has a history of failure to appear, including just days before this arrest.”

In arguing for his client’s pre-trial release with electronic monitoring, O’Brien told the judge that Grier’s aunt, who was in the courtroom Thursday, would serve as his sponsor and guarantee his court appearances. He also noted that Grier works as a maintenance man for an apartment complex and presented his boss, who said Grier could continue working for him.

“He wants to fight the charges. He wants to fight the homicide charges, the murder charges,” O’Brien said. “He wants to clear his name. He will show up to fight those charges."

“Yes,” Grier chimed in.

Corey L. Grier, 21, of Woodbury, enters the courtroom for his detention hearing, Thursday, Feb. 7, 2019. Grier is charged with murder, robbery, conspiracy, burglary and theft.Joe Warner | For NJ Advance Medi

“He’s adamant that he had no involvement in the actual homicide,” O’Brien continued.

Grier is a high school graduate who recently enrolled in Pennco Tech. He has joint custody of a 3-month old daughter for whom he provides financial support, O’Brien noted. He’s also doing “fairly well” in drug court, he added.

In sealing her argument against release, Anton noted that Grier could hinder the investigation if released.

“There may still yet be people to be charged in this, and those people are still in the community, and I think that his release may pose some issues for that as well,” she said.

Citing his criminal record, danger to the community and potential to obstruct the case, Smith ordered Grier’s pre-trial detention.

He will remain in Salem County Correctional Facility, where Oswald is also housed.

Oswald was indicted on murder, robbery, theft and weapons charges in October.

Grier will return to court March 14 for a pre-indictment conference.

Matt Gray may be reached at mgray@njadvancemedia.com. Follow him on Twitter @MattGraySJT. Find NJ.com on Facebook. Have a tip? Tell us: nj.com/tips. Get the latest updates right in your inbox. Subscribe to NJ.com’s newsletters.