WASHINGTON — When President Obama proclaimed that those who commit sexual assault in the military should be “prosecuted, stripped of their positions, court-martialed, fired, dishonorably discharged,” it had an effect he did not intend: muddying legal cases across the country.

In at least a dozen sexual assault cases since the president’s remarks at the White House in May, judges and defense lawyers have said that Mr. Obama’s words as commander in chief amounted to “unlawful command influence,” tainting trials as a result. Military law experts said that those cases were only the beginning and that the president’s remarks were certain to complicate almost all prosecutions for sexual assault.

“Unlawful command influence” refers to actions of commanders that could be interpreted by jurors as an attempt to influence a court-martial, in effect ordering a specific outcome. Mr. Obama, as commander in chief of the armed forces, is considered the most powerful person to wield such influence.

The president’s remarks might have seemed innocuous to civilians, but military law experts say defense lawyers will seize on the president’s call for an automatic dishonorable discharge, the most severe discharge available in a court-martial, arguing that his words will affect their cases.