BRENTWOOD — There were 5,500 unopened emails waiting for Rockingham County Attorney James Reams when he returned to his office Wednesday after a six-month court battle over his ouster.

Reams arrived at work with his wife, Janis, toting coffee and doughnuts for his employees.

“It’s kind of like I have been on vacation a while,” he said. “It wasn’t as odd as coming in after the first time I was elected. Someone had put a welcome-back sign on my door.”

A judge on Tuesday approved an agreement that Reams, of Hampton, struck with the state, which allowed him to return to work as the county’s top prosecutor. Reams had filed a lawsuit against Attorney General Joe Foster and the Rockingham County Commissioners that upended his suspension on April 10. Last Thursday, the state Supreme Court declined to hear an appeal in the matter until removal proceedings are complete.

Reams said he looks forward to getting access to witness statements and other evidence amassed by state and federal prosecutors that led the attorney general to file a complaint for removal.

A 10-day trial is set to begin Aug. 4, where prosecutors are expected to lay out evidence that Reams sexually harassed female subordinates and mismanaged a forfeiture account used for office supplies and work-related travel.

“If I had done any of the things that they had alleged, I wouldn’t have put my family through this,” said Reams, who became emotional as he sat behind his desk on Wednesday. “I talked to them about it. They said to go for it. They said don’t let them intimidate you out of the truth.”

Reams said he has no regrets about waging his months-long court battle with the state and paying a tidy sum in legal bills to regain his last remaining months in office.

“I had no choice. That’s the way I looked at it,” he said. “You look at the allegations and they said I discriminated against people, but they don’t give an example of how a person was discriminated against.”

His office, which sports a poster of The Beatles behind an L-shaped desk, was essentially intact following a search by investigators.

“It pretty much looks the way I left it with the exception of some files that were taken,” he said.

Reams, a Republican, has held his $85,000-a-year post since 1998, through eight elections. He said that his decision to not seek reelection remains final.

“People asked me to run again, but I am not going to do that,” he said. “I made the decision two years ago. My wife and I decided together. My close friends and family knew. I am not going to change that.”

Of his remaining nine months in office, Reams said: “There are still some projects I would like to get finalized.” He wants to finish work on a statewide database for prosecutors and make sure a backup system for his office’s computers is completed.

Reams said he wants to help the person who wins his seat in the fall election.

“I want to have a better transition for whoever takes over, at least better than the one I went through,” he said. “There are things they have to think about.”

He said he has no set plans for whether he will continue working after his term ends.

“I think I will do something,” Reams said. “It’s unlikely to be anything in public life. I would be happy pumping gas at a boat dock on Lake Winnipesaukee somewhere.”

In the meantime, Reams said he is interested in possibly appointing someone to carry out the deputy county attorney’s duties.

His longtime deputy, Tom Reid, resigned in January. His agreement with the state allows an assistant county attorney to carry out the deputy’s duties, but cannot take the job in title. “I will take a week or 10 days to assess how things are going,” Reams said. “It still makes sense to have a deputy.”