A former top DeKalb County prosecutor testified Thursday that he left that job over concerns that the office’s investigation of suspended CEO Burrell Ellis was illegal.

Don Geary, DeKalb’s former chief assistant district attorney, paused a long time when asked why he resigned. His answer: “Because I didn’t want to be arrested.”

His testimony was at odds with testimony by District Attorney Robert James, who made a rare appearance on the witness stand himself because a judge ordered it. Accusations flew in a hearing that laid bare intense divisions in the office over the investigation that led to Ellis’ indictment.

Geary followed his former boss James to the witness stand, and their versions of events were so completely at odds, it left courtroom observers wondering what really happened during key parts of the probe.

James denied all wrongdoing during two hours of testimony. He portrayed Geary as a disgruntled employee whose role had been diminished because he was suspected of leaking confidential information to the news media.

James strongly denied Ellis’ legal team’s accusation that the corruption prosecution is a political vendetta.

“That’s absurd,” the district attorney testified. “It’s wrong to use that authority in a vindictive fashion … It’s abhorrent.”

James said he began to focus on Ellis after learning Ellis had allegedly given false statements to a special-purpose grand jury. He said he then heard secretly recorded conversations in which Ellis shook down county vendors for campaign contributions.

“I was just doing my job,” James said.

Ellis is charged with 14 felonies, including extortion, perjury, theft, bribery and coercion.

Thursday, his legal team convinced Superior Court Judge Courtney Johnson there were enough questions about the investigation that James and his former top aides needed to testify about it.

A standing-room-only crowd of onlookers and Ellis supporters, who wore red “I support Burrell Ellis” buttons, gave grunts of disapproval and murmurs of appreciation to much of the testimony. Ellis’ wife and mother sat behind him in the front row. More than a dozen Ellis supporters remained throughout the daylong hearing and hugged him in the courtroom when it adjourned for the day.

The hearing was convened to consider motions filed by Ellis’ legal team that seek to dismiss the indictment, disqualify the District Attorney’s Office and suppress certain evidence. It continues Friday.

Geary, now chief assistant district attorney in Cobb County, testified that James was fixated on Ellis from the get-go. On his first day as district attorney, James wanted to know what evidence his office had against Ellis, Geary testified.

This remained James’ focus throughout the probe, even though the investigation had uncovered $300 million in possible contract fraud and implicated former CEO Vernon Jones, Geary testified.

Instead, Geary testified, “We were redirected to someone we had no evidence on.”

Geary said that in the summer of 2012, James called him into his office and played a video on his computer. In it, Ellis could be seen sitting at his desk in his county office and speaking to someone on the phone about contracts and campaign contributions, Geary said.

He said he became alarmed when James told him he had no warrant or court order allowing the secret recording. He said he asked James how many of these videos the office had and James replied, “ ‘More than a few.’ ”

Geary said he then took a book of Georgia’s legal code off the shelf and showed James a relevant section on wiretapping and videotaping.

“It could be the commission of two felonies,” Geary said he told James.

Ellis’ lead defense attorney, Craig Gillen, next called on John Melvin, a prosecutor who once headed the DeKalb corruption probe, in an attempt to buttress Geary’s testimony. Like Geary, Melvin resigned from the DeKalb office in December 2012 and now works in Cobb.

Melvin said he never saw any secretly recorded videos of Ellis. But he said Geary did show up in his office one day looking shaken.

As they walked to lunch, Melvin said, Geary talked about a video he’d just seen and said he thought “Robert had committed a felony.”

But Melvin disagreed with Geary’s contention that James directed investigators to focus on Ellis. Melvin said it was the evidence against Ellis that turned prosecutors’ attention toward him.

Melvin and former DeKalb Police Officer Jamie Payton, called as a witness for the prosecution, backed James’ assertion that Geary had limited involvement in the Ellis case.

Payton, who maintained the District Attorney’s Office’s evidence log, also testified that only one video recording of Ellis existed.

James strongly denied telling Geary that more than one video existed. He also said he never showed a video to Geary and that Geary never expressed concern over the legality of a video.

“Don never told me I was committing a felony,” James testified. “If Don had told me that, I’d have said, ‘Oh, my God.’ … I would have stopped the process and had a conversation.”

Before James stepped down from the stand, Chief Deputy Assistant District Attorney Anna Cross asked him whether there was a time when he began to question Geary’s integrity and his loyalty to the DeKalb District Attorney’s Office.

“I had some concerns,” James said. “I absolutely did. … By the end of his tenure, Don and I didn’t have much of a relationship at all.”

James said he suspected both Geary and Melvin had leaked information to Channel 2 Action News when a TV crew was stationed outside Ellis’ home when it was searched by investigators on Jan. 7, 2013. When he questioned them about the leak, James said, both prosecutors denied involvement.

But James said he was still not convinced. “I have suspicions,” he said. “I have beliefs.”

Since both Geary and Melvin left, James added, “Channel 2 doesn’t get scoops in my office anymore.”