Anthony Senatore, of Toms River, faces three years in prison under a plea deal. A year ago, the 35-year-old had rejected a plea bargain that would have carried a seven-year prison term.

Senatore was charged with keeping a loaded .22-caliber rifle unlocked in his bedroom, where his son found it in April 2013, took it outside and shot Brandon Holt once in the head.

He pleaded guilty Thursday to second-degree child endangerment for having the rifle and four shotguns unsecured in his house near ammunition and third-degree child endangerment for Brandon’s death.

Senatore’s children were 12, 8 and 4 at the time of the shooting.

Atlantic County Prosecutor Jim McClain said that Senatore will remain free on $100,000 bail until his Feb. 5 sentencing. McClain said he will also have to give up his firearms purchaser identification card.

Toms River is in Ocean County, but the prosecutor’s office in neighboring Atlantic County is handling the case at the direction of the state attorney general’s office. The switch was made because several members of Senatore’s family have worked in law enforcement in Ocean County.