The execution, the first carried out by the US military since 1961, had been the subject of a years-long legal battle.