BRANCHVILLE, N.J. (AP) — Two boys were injured on Wednesday when a black bear attacked their campsite in northwestern New Jersey, the authorities said.

The attack occurred in Stokes State Forest, in Sussex County, near the Appalachian Trail, the State Police said.

The bear tried to grab one boy from a tent, causing a minor foot injury, and swiped at another boy, causing a shoulder injury, said Lawrence Hajna, a spokesman for the state’s Department of Environmental Protection, adding that the bear also tried to enter a second tent.

Two adult counselors with the group of nine campers herded them to a shelter, where they made noise to try to scare the bear, Mr. Hajna said.

The bear left but soon returned and was rummaging through the campsite when a wildlife technician arrived and shot it in the neck.

The bear fled, and officials were still searching for it later on Wednesday.