NEW ORLEANS — Five former police officers were sentenced to prison on Wednesday for the shooting of six unarmed civilians, two of whom died, in the days after Hurricane Katrina and for orchestrating a wide-ranging cover-up afterward.

The four officers directly involved in the shooting were sentenced in federal court to lengthy terms ranging from 38 to 65 years, while a police sergeant who was charged with investigating the shooting, and instead helped lead the efforts to hide and distort what happened, was sentenced to six years.

But while the sentences were long, they were not nearly as long as prosecutors were seeking — in one case less than a third of the sentence the government recommended — and for the most part were either the mandatory minimum or a few years more than the minimum.

Before delivering the sentences, Judge Kurt D. Engelhardt of the Federal District Court for the Eastern District of Louisiana gave a two-hour speech condemning mandatory minimum sentences for interfering with judicial discretion and criticizing the case put together by federal prosecutors, saying in particular that he was “astonished and deeply troubled” by the plea deals with cooperating witnesses at the heart of the government’s case.