Throughout an afternoon of dense testimony, both prosecutors and the defense made it clear the bribery trial of former Massachusetts Probation Department commissioner John J. O’Brien will hinge on the answer to a single question: Did O’Brien calculate and execute a plan to raise money in 2005 for then-state treasurer Timothy P. Cahill in order to secure his wife a new job?

Prosecutors say O’Brien used his influence to turn out attendees at a fund-raiser for Cahill in exchange for a job at the state’s lottery commission for his wife — a plan they say he carried out with the help of four other state employees.

“We’re not alleging that Laurie O’Brien was unqualified for the job,” said assistant attorney general Peter Mullin, who is prosecuting the case. “We’re alleging that she got the job through her husband’s illegal means.”

Get Fast Forward in your inbox:

Forget yesterday's news. Get what you need today in this early-morning email.

O’Brien resigned in 2010 after an independent counsel concluded that he had committed pervasive fraud in hiring practices during his 12-year
tenure atop the Probation Department. He faces five state charges that carry penalties of one to five years in prison.

Prosecutors alleged that O’Brien had Edward Ryan, who worked for him in the department, approach Cahill’s chief of staff in the spring of 2005 about the possibility of a job for O’Brien’s wife at the Massachusetts State Lottery, which is under the treasurer’s supervision. That staffer, Scott Campbell, allegedly responded that Cahill was interested in a campaign fund-raiser and wanted to know if O’Brien was open to that idea.

The fund-raiser took place June 23 of that year at Pat Flanagan’s Pub in Quincy, and it was well-attended, with 50 Probation Department employees showing up, according to prosecutors, and netted more than $11,000 for Cahill’s campaign fund.

Within days of the fund-raiser, treasury officials had tentatively offered Laurie O’Brien a difficult-to-fill night-shift computer operator position, but two weeks later they offered her a more desirable customer-service job.

The trial is expected to hinge on the testimony of Ryan and Francis Wall, former deputy commissioner of the Probation Department, who prosecutors say was also in on the plan, both of whom were granted immunity in exchange for their testimony.

Defense lawyers said both men are testifying against O’Brien only to avoid charges themselves.

“Jack O’Brien didn’t conspire with anyone,” Paul Flavin, O’Brien’s lawyer, said before alleging that if there were a plan in place it was crafted by Ryan and Wall who, he said, are now trying to cover their tracks by testifying against O’Brien. “[Ryan] used Mrs. O’Brien’s situation in seeking a job in order to save himself.”

Flavin said his case will center on the testimony of the two lottery commission employees who interviewed Laurie O’Brien for the job, which she still holds. Neither, he said, will testify that they were pressured in any way to hire her or were ever aware of the fund-raiser for Cahill. “Not only is Jack O’Brien not guilty if participating in such a conspiracy,” he said. “Such a conspiracy didn’t happen. She obtained her position on her own.”

Ryan took the witness stand late in the afternoon, answering a lengthy series of background questions before the proceedings adjourned for the day, but most of the trial’s opening day focused on a series of witnesses called to confirm background information.

Prosecution witnesses included a lawyer from the state’s campaign finance office who testified about fund-raising laws, Cahill’s former campaign accountant who confirmed the amount raised at the fund-raiser, and a Probation Department official whose testimony outlined the probation department’s hiring procedures.

‘Not only is Jack O’Brien not guilty if participating in such a conspiracy. . . . Such a conspiracy didn’t happen.’

Ryan’s testimony Thursday centered largely on his work history and his first interactions with O’Brien, who he said he met at a golf fund-raiser in 2001.

More than half a dozen of O’Brien’s family members, including his wife, sat in near silence in the front row of the courtroom’s audience gallery, throughout the five hours of proceedings. During one intermission, O’Brien chatted with them, holding his wife’s hands in his own and smiling.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.