The Deserter
(1971)

Basically, The Dirty Dozen in the Old West. This movie was designed to make Yugoslavian actor Bekim Fehmiu an American star.  While that did not succeed, they were able to recruit a lengthy list of well known actors to co-star.  

Captain Caleb (Bekim Fehmiu) leads a cavalry patrol into a mission, where they find everyone has been killed by Apaches.  His wife was there, and was skinned.  He blames the army, as there were supposed to be soldiers stationed there.  Caleb shoots his commanding officer (Richard Crenna), and deserts into the wilderness.  The army is having no success against the Apache.  

The Apache are camped across the border in Mexico, where the army can not touch them.  They cross to raid and pillage, then flee back to safety in Mexico.  Caleb is running his own one man war against the Apache.

General Miles (John Huston) arrives, and sends Tattinger (Slim Pickens) for Caleb.  Caleb is recruited to lead a small "unofficial" unit across the border after the Apaches.  He picks the meanest nastiest crew from the fort (including Chuck Connors, Ricardo Montalban, Slim Pickens and Patrick Wayne).  Caleb takes them into the desert and teaches them to fight, track and live like Apache.

The Apache are holed up in a mountain camp, where they think they are safe from attack.  Caleb and his men climb the mountain range, and sneak up from behind.  In the crossing, the racist Schmidt redeems himself dying trying to save Jackson from falling.  They place dynamite, destroying the Apache hideout.  There is a big shootout with the surviving Apaches.  Most of Caleb's men die.  Caleb, Brown, Crawford and Natachai are the only ones who return to the fort.  General Miles tells them the army refuses to drop the charges against Caleb.  In the official report, they put that Caleb died at the Apache camp.  He can live free under a new name.  

Thanks Joseph C!