The father of a 4-year-old killed earlier this month by a self-inflicted gunshot was criminally charged Wednesday with improperly securing the gun, authorities said.

Andrew Mack, 31, is charged with endangering the welfare of a child and a disorderly persons offense for not properly securing the weapon with a child present, Burlington County Prosecutor Scott Coffina said in a statement.

Andrew Mack was in bed asleep with the 9-millimeter handgun next to him on Feb. 7 when his son Lincoln grabbed the firearm, Coffina’s statement said. He then ran into another room, where he was playing with his sister, in the family’s home in the Browns Mills section of Pemberton Township.

Lincoln then pointed the gun at himself and fired it. EMTs found him with a bullet wound in his cheek and he died at a hospital an hour later.

“The death of Lincoln Mack was a tragedy, and it was made all the worse by the fact that it was entirely avoidable,” Coffina said. “Our deepest sympathies are with the Mack family and all of those who loved Lincoln, however, the defendant must be held accountable for not securing his firearm.”

Friends of the Mack family were raising money for the boy’s funeral expenses on GoFundMe. Michael Tamburri, a family friend, called Lincoln “the happiest 4-year-old you’ll ever see" who was “always smiling and happy."

Andrew Mack, an active duty member of the U.S. Navy, is in the Burlington County Jail, and scheduled for a first appearance in Superior Court in Mount Holly on Thursday.

Joe Brandt can be reached at jbrandt@njadvancemedia.com. Follow him on Twitter @JBrandt_NJ. 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.