FORT BRAGG, N.C. — It was an illicit and volatile love affair that spanned two war zones and four countries. The married general couldn’t stay away from a captain on his staff. She fell hard for her boss and called him “Poppa Panda Sexy Pants.” The three-year entanglement ended disastrously for both, at a time that could not be worse for the Army.

All the raw and sordid details are spilling out in an austere military courthouse here, where the Army is girding — for only the third time in half a century — to court-martial one of its generals.

Brig. Gen. Jeffrey Sinclair, an Army Ranger and paratrooper, stands accused of forcible sodomy, adultery and other charges that could land him in prison. Prosecutors say he abused his command authority by sleeping with a subordinate officer, a taboo in the armed forces and a violation of military law. They charge that the relationship turned violent on two occasions, when he allegedly forced her to perform oral sex.

In addition, Sinclair faces charges that he had inappropriate communications with three other female officers.

Sinclair has pleaded not guilty to all charges. Besides the rare spectacle of a general in the dock, however, the case poses a critical test of how the U.S. military handles allegations of sexual assault and misconduct, crimes that have long bedeviled the armed forces.

Congress and President Obama have demanded a crackdown, alarmed by a recent string of scandals and frank admissions by military leaders that they have systematically failed to address the problem.

A growing faction of lawmakers is pushing to rewrite the underpinnings of military law by giving power to uniformed prosecutors, instead of commanders, to oversee investigations of sexual abuse and other serious crimes. The Pentagon is resisting, arguing that commanders must retain the authority to enforce order and discipline in their units.

The last Army general to face court-martial was Brig. Gen. Roger Duff, who pleaded guilty in June 2012 to making false official statements and wearing unauthorized decorations. The Army did not publicly disclose that Duff had been court-martialed until months later, when Sinclair was charged.

In 1999, Maj. Gen. David Hale pleaded guilty at court-martial after he was accused of committing adultery with the wives of four subordinates. He was fined and demoted. Before that, no Army general had faced court-martial since 1952, when Maj. Gen. Robert Grow, a military attache in Moscow, was suspended and reprimanded on charges of dereliction of duty.

Given the intense debate in Congress over possible far-reaching changes to military law, all sides are intently watching how Sinclair’s court-martial plays out. It is scheduled to begin Sept. 30 after months of evidentiary hearings and pretrial wranglings that have foreshadowed what is at stake.

Last week, the Army finished selecting a jury of five major generals, all men, who will determine Sinclair’s fate. Under military law, each juror must be senior in rank to the defendant. More than 40 generals were summoned to Fort Bragg from around the world to be interviewed. Most were rejected because they knew Sinclair or other key potential witnesses.

During jury selection, lawyers for both sides acknowledged the heavy political pressures swirling around the case.

They asked the potential jurors if they were worried that they might be passed over for promotion if they reached an unpopular verdict. They also questioned whether the generals could resist outside influences, such as Obama’s angry comments in May, when he demanded that military sex abusers be “prosecuted, stripped out of their positions, court-martialed, fired, dishonorably discharged — period.”

Virtually all the generals said that sexual assault is a serious problem in the ranks and that they had previously heard about the charges against Sinclair. One juror revealed that he had attended an Army-mandated training session on sexual assault prevention in which Sinclair was depicted as a case study in bad behavior.

Another commander, Maj. Gen. Kendall Penn of the First Army, candidly recalled what he thought when he first read news accounts of the case. “My general reaction was, this is going to be a black eye on the Army,” he said. He was later culled from the jury pool.

Retired Maj. Gen. Charles Dunlap Jr., a Duke University law professor and a former deputy judge advocate general for the Air Force, said the atmosphere surrounding sexual assault cases in the military has become “hyperpoliticized.”

He said that Sinclair could receive a fair trial but that the five jurors will have to “exercise moral courage in a way they’ve perhaps never been asked to do before in a military justice setting.”

– – –

Although Sinclair has pleaded not guilty, his attorneys acknowledge that he carried on an affair with a subordinate officer 17 years his junior. The Washington Post usually does not name the victims of reported sex crimes.

During a pretrial hearing last year, the woman testified that the pair had sex in the general’s quarters in Iraq, in her car in a German parking lot, in plain sight on a hotel balcony in Arizona and in her cramped office in Afghanistan, among other places. Some soldiers wondered and snickered about their relationship, but nobody reported it.

The depth of their passion might have remained hidden if the general and the captain hadn’t bombarded each other with explicit text messages. Defense attorneys have read many out loud in court.

“You are my heart and world you beautiful magnificent man,” the captain texted the general in September 2011, during one of their tamer exchanges. “I need you and I mean really deeply profusely need you.”

Many of the text messages betray a dark side to the affair — angry accusations from the unmarried captain, as well as threats to kill herself or expose the affair to Sinclair’s superiors. During an evidentiary hearing at Fort Bragg, she testified that they fought continually but usually made up afterward.

“You are going to make me do something really stupid,” she wrote early last year in a typo-filled text. “How about I just [expletive] call [Sinclair’s commander] and have him resolve this, Im sure he will take the time to keep me from being suicidal. I well not let yoy continue to screw me over.”

The final straw came in Kandahar, Afghanistan, in March 2012. The captain was snooping through Sinclair’s email in his office and discovered tender messages to his wife, as well as love notes to another female Army officer.

“I felt so stupid,” the captain testified. “I finally had something to slap me in the face and say, ‘See, he never loved you. He was just using you for sex.’ ”

By her own admission, she flew into a jealous rage. First, she fired an email to the other female officer, saying, “I hope you don’t think you’re the only girl that he’s sleeping with.”

Later that night, she burst into the office of Maj. Gen. James Huggins, then the commander of the 82nd Airborne Division and leader of all U.S. forces in southern Afghanistan. Tears streaming down her face, she spent two hours confessing to the affair, according to court testimony.

That set off a flurry of phone calls and emails among senior Army brass, who were stunned but immediately ordered a full investigation that eventually roped in more than 100 witnesses.

The case grew more serious when the captain gave a formal statement accusing Sinclair of sexual assault by forcing her to perform oral sex against her will on two occasions in Afghanistan.

She also asserted that he had once vowed to kill her and harm her family if she ever told his wife about the affair. Sinclair’s attorneys deny that he made the threat.

– – –

The Army charged Sinclair with forcible sodomy because of the oral sex allegations. The captain testified that the assaults occurred between December 2011 and February 2012 but said she cannot recall the exact dates.

During an evidentiary hearing in November, she said that she still had feelings for Sinclair and that she had not wanted the Army to charge him with forcible sodomy or a violent crime.

“It’s tearing me up, and in a [expletive] way I still love him, and I don’t want him to be upset with me,” she said. “I know it’s very messed up, but there’s a part of me that wants to believe that he really did love me and that I just misinterpreted his actions.”

Defense attorneys have accused her of making up the assault allegations to save her Army career. They said she first told one confidant that the relationship was entirely consensual but gave investigators a different version after she realized that she, too, could be kicked out of the Army for adultery.

Richard Scheff, an attorney for Sinclair, noted that the woman has since been granted immunity by the prosecution. “The evidence in this case is paper thin,” he said. The captain, he said, has “changed her story again and again.”

Legal representatives for the woman did not respond to a request for comment placed through Army public affairs officials at Fort Bragg.

In an unusual move in the button-down world of military justice, Sinclair has hired four civilian defense lawyers and a national public relations firm, MWW Group. They have created a website — — to dissect the case and challenge the Army.

In an interview, Scheff said the Army “grossly overcharged” his client. Given Washington’s marching orders to the military to get tough on sexual assault, he said, he doubts that any jury could render a fair verdict for Sinclair.

“They’re in the spotlight on this,” he said. “They’re under such enormous pressure to change the culture on sexual assault.”

A Fort Bragg spokeswoman said prosecutors are not permitted to comment on a pending case.

– – –

Sinclair also is charged with having inappropriate relations with three other female junior officers.

In combing through his emails, investigators found nude photos and flirtatious messages from two of the women, but no evidence that he had sex with them. One of those officers testified that she repeatedly avoided meeting him in person, however, because she assumed he wanted to have a tryst.

At the same time, each of the three female officers testified that they admired Sinclair, considered him a mentor and didn’t want to cut off contact. Instead, they frequently sought out the general for career advice and professional favors.

In November, Sinclair’s wife, Rebecca, stunned many in the Army when she wrote an op-ed column in The Washington Post to declare that she was sticking by her husband and that she blamed his infidelity on “the stress of war.”

In an interview this month, Rebecca Sinclair said her husband may be a cheater but not a violent abuser. “I don’t excuse my husband’s bad behavior or bad judgment,” she said. “I never said it’s okay. I said I understand how it could happen.”

Although she has not attended most of the court proceedings, she said she’s still living with the general. “We’re doing the best we can,” she said. “It’s draining.”