The details I remember are too vague to Google... apparently.
The story surrounds the crew of the Enterprise discovering that the leader of the village where they're visiting (I forget why) is actually a Starfleet Captain who has abandoned his command and is aiding the aboriginals in violation of the Prime Directive.
I'm pretty sure it's not Private Little War, nor A Taste of Armageddon, but I'm open to being convinced.
I don't remember any names or other specific details, only that (spoiler for Star Trek Beyond):
...it's essentially the same bad guy as in Star Trek Beyond.
I'll update with any details I remember...