WASHINGTON — The Senate is heading for a showdown over contentious legislation to curb sexual assaults in the military by taking away the authority of senior commanders to prosecute rapes and other serious offenses.

A highly anticipated vote on the bill sponsored by Sen. Kirsten Gillibrand, D-N.Y., could come as early as Thursday.

The Pentagon’s top brass is firmly opposed to the measure, arguing that officers should have more responsibility, not less, for the conduct of the troops they lead.

Gillibrand’s bill has won the support of 54 of her colleagues, illustrating the deep frustration among Republicans and Democrats over the military’s failure to stem the epidemic of sexual assaults in the ranks. Gillibrand, however, will likely need 60 votes to clear a filibuster.

The Pentagon came under pressure last month to disclose more information about how sexual assault cases are adjudicated following an Associated Press investigation that found a pattern of inconsistent judgments and light penalties for sexual assaults at U.S. bases in Japan.