WASHINGTON — Sen. Kirsten Gillibrand’s crusade to put the military’s sexual-assault cases in the hands of an independent prosecutor was stopped in its tracks yesterday by a fellow Democrat.

Her legislation — which would have taken decisions about how to handle the cases away from military commanders — was nixed by the Senate’s Armed Services Committee chairman, Sen. Carl Levin.

Levin (D-Mich.) announced that he would side with military brass who oppose Gillibrand’s measure.

The chairman said he would offer a “compromise” version to replace Gillibrand’s plan in the policy-setting Defense Authorization Act.

The move sets up a Democrat-vs.-Democrat fight in the Senate. Gillibrand is already developing a strategy to beat Levin and restore the legislation during floor debate, according to sources close to the New Yorker.

Sen. Barbara Boxer (D-Calif.) rallied to Gillibrand’s defense, saying she was “stunned” by the chairman’s decision.

“Instead of embracing a broken system, the full committee should pass the reforms backed by the [panel] that emulate our allies in Israel, Great Britain, Australia and Canada,” she said. “I look forward to fighting for these critical changes on the floor of the Senate.”

Gillibrand began championing sex-assault victims in the military after a series of high-profile cases, including the arrest last month on sexual-battery charges of the Air Force’s chief of sexual-assault prevention.

The Defense Department estimates that there are about 26,000 incidents of sexual abuse in the military every year.