In a remote village in the dangerous northeastern Kunar province of Afghanistan, Army Green Beret Major Jim Gant was doing something few others had — he was making progress against the enemy.

To do so, he and his men went native — trading their body armor for traditional Afghan garb, growing long beards, speaking the local Pashto tongue, and forging close alliances with tribesmen, who would come to revere Gant as “Commander Jim.”

But when he went to bed at night, Gant had one thing his men did not — company.

Ann Scott Tyson, a Washington Post war correspondent, quit her job to live secretly with him on the front lines — where he taught her how to shoot an assault rifle for protection. They drank alcohol and made their own rules.

When his commanders got wind of the domestic bliss he carved out for himself in the heart of a war zone, Gant was quietly relieved of his command and pushed to retire in disgrace.

Once nicknamed “Lawrence of Afghanistan” by Gen. David Petraeus, Gant was now more like Col. Walter Kurtz, the Green Beret who goes native — then loony — in the 1979 film “Apocalypse Now.” Gant indulged in a “self-created fantasy world,” his commanders charged.

To this day, Gant remains as defiant as Kurtz.

“They treated me like a crazed criminal instead of who I was,” Gant, 46, tells The Post. “My expectation was only ever that I would be treated honorably, and that just did not happen.”

The son of schoolteachers, Gant grew up hunting rattlesnakes in Las Cruces, New Mexico, where he was inspired to enlist after reading Robin Moore’s 1965 book “The Green Berets.”

“I grew up pretty tough. I had a real tough dad,” he says. “Ever since I could remember, I’ve never had a problem fighting. I used to fight a lot when I was younger — so it almost felt like an extension of that for me.”

He enlisted in the Army in 1986, went through special forces training and fought in the first Gulf War. In 2003, Gant was deployed to Afghanistan.

He quickly learned there were only two ways to succeed — either get in a gunfight with the Taliban, or find people who would be friendly to the cause.

And in the village of Mangwel, where he met tribal chief Malik Noor Afzhal, he found the latter.

Gant showed the leader — whom he nicknamed “Sitting Bull”— footage of the 9/11 attacks, which Afzhal said he had never seen before.

“I said we had come there to fight the enemies of my country,” Gant recalls.

Here, the seeds were sown for Gant’s combat philosophy, which would inform a 45-page treatise he wrote in 2009 called “One Tribe at a Time.”

“It’s about people. It’s about face-to-face relationships. It’s about the ability to get in there and find out what is going on on the ground and figure out how you can best leverage that resource in Afghanistan which means the most — people,” he says.

He didn’t get the chance to fully realize this initiative until 2010, when Petraeus, then in command of the US forces in Afghanistan, ensured that Gant would go back to test out his “native” theory, charging him with supervision of “village stability operations.”

By that time, Gant — awarded a Silver Star for a brutal battle in Iraq in 2006 — was attracting attention from journalists such as Tyson, 55, a Kansas native who covered wars in Iraq and Afghanistan.

The two first spoke over the phone in 2007 and eventually met in Washington, DC, in 2010, when the pair — both separated from their spouses and each with four kids — quickly fell in love.

“We spoke each other’s language,” Tyson says.

When they met, Gant was grappling with post-traumatic stress disorder — he still is — and it was Tyson’s wartime experiences that provided her with a deep understanding of what he was going through.

“Not only could I talk to her, I loved looking at her, and she is a very wonderful woman, as well,” Gant says.

Gant left for Afghanistan in June 2010, and in March 2011, Tyson left her job to join him.

She was a true believer.

“The mission he was embarking on made a great deal of sense to me,” Tyson says. “I had seen the military take a much different approach to the point that they were having zero contact with the Iraqis and the Afghans. It was not working.”

The couple lived alongside Afghan tribal fighters in mud-walled compounds with crude latrines and no running water. An Afghan cook whipped up meals for everyone, usually rice and beans with flatbread. On special occasions, they’d eat watermelon.

The couple would stroll through the village together, where they’d meet locals, who would sometimes invite her alone into their homes.

“One woman brought out a copy of the Koran, and she started reciting it and asking me to recite after her,” Tyson says. “It was very moving for them to share their religion with me — an infidel American woman. It was extremely powerful.”

And she made an impression on Sitting Bull, who called her his “daughter-in-law” and took her into the interior courtyard of his home — where even Gant had never set foot.

“It was a family atmosphere, totally different. Joking, laughing, children were playing on swings. The babies were in the hammocks,” she says. “The symbolism was that I was part of his family.”

Gant taught his lover practical skills — such as how to fire weapons.

“I mainly learned how to use a 9mm, AK-47 and an M4. I learned a bit on the larger guns mounted on vehicles,” she says. “This was all as a last resort, in case of a dire emergency.”

She said she fired the guns only in training, where she also learned how to hand off ammo to a turret gunner.

“You can absolutely say I was his right-hand woman,” she says. “I had many different roles, primarily offering a rare opportunity to build relations with the women in the village.”

Gant says it was not irresponsible for him to bring his lover to Kunar, a hornet’s nest of Taliban and al Qaeda. Rather, it showed the tribesmen the ultimate respect — he trusted them with the safety of the woman he loved.

While there, she was working on her new book, “American Spartan: The Promise, the Mission and the Betrayal of Special Forces Major Jim Gant.”

Before long, Gant and the 17 men in his command didn’t even need to request assistance when things got hairy.

When there was word that a suicide bomber was headed to Mangwel, it was the local mosque that sounded the alarm over its loudspeaker.

“We did not ask them to do this,” Gant says. “That’s a pretty remarkable thing to happen in an Afghan village. I didn’t have one checkpoint in Mangwel, I had 4,000.”



In short, your actions disgraced you as an officer and seriously compromised your character as a gentleman. - The Army's letter of reprimand

So it was no wonder that when Petraeus awarded him a Joint Service Commendation Medal for his work in Mangwel, Gant knew who also deserved the honor — his old friend Sitting Bull. The next day, he gave it to him. “Without you, there is no me,” he told him.

Twenty-two months after he arrived — and almost a year since Tyson joined him — a lieutenant tipped Gant’s superiors to their cozy living arrangement, as well as other behaviors, including prescription drug and alcohol use.

“None of his bosses knew that Ann was there,” Army 1st Lt. Thomas Roberts told ABC. “He didn’t follow any [rules]. He was definitely erratic. He did not act in a stable manner.”

Roberts filed a sworn statement in March 2012, accusing Gant of “immoral and illegal activities and actions,” claiming the major was “intoxicated and under the influence of pain medications.”

Gant was airlifted out of Afghanistan, stripped of his special forces honors, demoted to captain and pushed into retirement — a case the Army kept quiet about until Tyson wrote her book.

His beard was shaved, and he received a letter of reprimand, signed by Lt. Gen. John Mulholland.

“In short, your actions disgraced you as an officer and seriously compromised your character as a gentleman,” the letter reads.

Gant admits to popping pills and says he knows his superiors’ hand was forced once the allegations surfaced.

“Any statement that I lived in a self-indulgent fantasy world is not correct. I did drink alcohol. I did take sleeping pills. I did take pain medication. I did break other rules with regard to operational guidance,” he says.

But he says those are minor infractions compared to the progress he was making.

“It’s ironic to me that [they] would use the term fantasy. It’s almost as though their view of Afghanistan is the real fantasy,” says Tyson, who escaped the country on her own. The brass never caught the two together.

The couple was finally married in Maryland in May 2013 and went back to Afghanistan to “properly” say goodbye to Sitting Bull that September.

They now live in Seattle, and plan to one day return to Afghanistan. “Under the right circumstances,” Tyson says.