For Attorney General Eric H. Holder Jr., the past year has been something of a lonely pursuit.

He believed that the accused Sept. 11, 2001, conspirators should be tried not by the military but in federal court, saying such a trial would be the “defining event” of his tenure as the nation’s chief law enforcement officer. He kept pushing, even as the White House quietly shelved the idea and congressional Democrats joined Republicans in opposition.

That ended this week, when Holder stood before the cameras to say his plan was dead. He had lost the debate, and worse, he was publicly announcing a decision he clearly opposed. Visibly frustrated, he abruptly ended the news conference and left the stage.

Since he was nominated more than two years ago, Holder has occupied a unique place in the Obama administration. Perhaps more than any other Cabinet member, he has been a target for Republican attacks. Yet he enjoys a close relationship with President Obama and will be known to history as the nation’s first black attorney general.

Even as he announced Monday that Khalid Sheik Mohammed and four alleged co-conspirators will be tried before a military commission at the Guantanamo Bay prison instead of in Manhattan federal court, Holder was unbowed.

“Look, I grew up in New York City, you know?” he said. “ . . . It is still my view that the case could have been tried in Manhattan.”

Holder’s words reflected his frustration that others didn’t agree, as well as his certainty — honed over more than two decades as a prosecutor, judge and private lawyer — that his path was the right one, according to law enforcement officials and people close to him.

The attorney general first announced in November 2009 the planned prosecution of Mohammed and his co-defendants in New York, a key change from the policies of the George W. Bush administration. Monday’s announcement not only reversed that plan but was a major blow to the administration’s efforts to close the detention center in Cuba.

“He is comforted by the fact that he still believes he was dead-on right, and he believes that’s how history will record it,” said Reid Weingarten, a Washington lawyer and close Holder friend. He said that Holder’s demeanor at the news conference “was just frustration” and that the opposition of some White House staffers and congressional Democrats to his plan for federal trials “sort of adds to that.”

Inside the Justice Department, the prevailing emotion on Tuesday, from the attorney general on down, was relief. Officials said the uncertainty about the trials had hampered their ability to draw attention to other priorities, such as a crackdown on health-care and financial fraud and the fight against violent crime.

“It’s liberating in a lot of ways,” said one Justice Department official, who spoke on the condition of anonymity to discuss internal deliberations.

On Capitol Hill, where Republican critics of the administration offered measured praise of the decision to try Mohammed at Guantanamo Bay, Holder’s sharp words for Congress did not go unnoticed. The attorney general on Monday blamed legislators for erecting barriers to bringing detainees to the United States.

“The first thing that struck us was the almost hostility to Congress,” said one GOP aide, who was not an authorized spokesperson and spoke on the condition of anonymity. “He obviously didn’t believe in his own position.”

But congressional aides in both parties, along with experts, said Holder’s defeat on the high-profile issue will not affect his ability to govern the sprawling department.

“This is obviously an important issue, but I don’t think it’s going to be the first line in his obituary,” said Michael Greenberger, a University of Maryland law professor and former Justice Department official. “There are many overwhelmingly important issues that the department handles.”

Soon after Holder was nominated for his post in December 2008, a chorus of GOP lawmakers questioned whether he would be too far to the left on national security. The criticism intensified over the administration’s handling of cases such as the attempted bombing of a Detroit-bound airliner on Christmas Day in 2009.

But it was Holder’s plan for civilian trials for the Sept. 11 suspects that crystallized tensions over the administration’s national security policies. The announcement triggered strong opposition from congressional Republicans, who said the attacks on the World Trade Center and the Pentagon were acts of war and should be prosecuted in a military tribunal.

Holder stood firm, telling the New Yorker in an interview last year that he believed that trying Mohammed in a federal courtroom would be “the defining event of my time as attorney general.”

As the case remained in limbo for much of the past year, Holder “held out as long as he could for some sliver of hope” for federal trials, said one federal law enforcement official who was not an authorized spokesperson.

But when Congress in December barred the transfer of Guantanamo Bay detainees to the United States for any reason, including prosecution, “it was clear to him . . . that the only viable alternative was a trial in military commissions,’’ a Justice Department official said.

In the end, according to officials and people close to Holder, he made the decision to pull the plug on civilian trials, with White House support. “I don’t think anybody issued an order or told him he had to,” said one friend of Holder’s, who spoke on the condition of anonymity to discuss private conversations. “He understands the way the world works. He’s a grown-up.”

Staff researcher Julie Tate contributed to this report.