A judge in Detroit has ruled in favor of American Airlines in a lawsuit by five men of Iraqi descent who claimed their nationality caused a captain to cancel a flight to Chicago.