JERUSALEM — The Israeli military on Tuesday censured soldiers who filmed and cheered the shooting of a Palestinian man across the barrier fence in Gaza several months ago, in a video that added to the scrutiny of Israel over its killing of nearly 30 Palestinians in protests in the past two weeks.

But at the same time, the military defended the shooting of the man, who was standing motionless and appeared to pose no obvious threat to the soldiers at that moment. It said he was shot during a violent, two-hour riot on Dec. 22 and that the man, described as a suspected organizer, was hit in the leg and injured.

The military said the protesters hurled rocks and tried to sabotage the security fence, adding that the shooting was preceded by verbal warnings, calls to halt, riot dispersal means and warning shots.

“After none of these were successful,” it said, “a single bullet was fired toward one of the Palestinians who is suspected of organizing and leading this incident, while he was a few meters from the fence.”