RICHMOND, Va. — Five days of grueling, often contentious testimony by Bob McDonnell, the former Virginia governor accused of corruption, ended Tuesday with an apology from Mr. McDonnell for accepting so many gifts and so much money, but an emphatic denial that he had conspired with his wife to sell his office.

The federal trial, already 22 days long, could go to the jury as early as Wednesday. Lawyers for the former Virginia first lady, Maureen McDonnell, must present her defense, but her lead lawyer promised that it might take only three hours.

After Mr. McDonnell’s testimony in his defense, the jurors were left with a puzzle. The gifts are not in doubt, $177,000 in cash, loans, vacations, Ferrari rides, equipment and rounds of golf, a Rolex watch and even an electric generator, so much that Mr. McDonnell, once considered a contender for the Republican presidential nomination, had to concede that he regretted his actions.

What the donor, Jonnie R. Williams Sr., the chief executive of nutritional supplement maker Star Scientific, wanted in return is also little in doubt. Mr. Williams repeatedly made clear in emails, texts, phone calls and conversations aboard his private jet that he hoped the governor would help start clinical trials of his anti-inflammatory product Anatabloc at a prestigious Virginia university.