Former Philadelphia Sheriff John Green on Tuesday defended his handing out unwritten contracts worth millions of dollars to a campaign ally who later became a financial benefactor, saying he had been advised that the practice was legal.

Nor did he have to abide by rules requiring that contracts be reviewed by the city's Law Department, Green told a federal jury that likely will begin deliberations in his bribery and corruption trial Wednesday. "It was important that the sheriff's department, because of the nature of its work, remain independent," Green testified.

Green's testimony was undercut earlier in his lengthy trial. He told jurors that he had relied upon advice from an aide, lawyer Matthew Carrafiello, then the undersheriff. But Carrafiello, now a city judge, testified that Green never asked him about contracts. Had Green done so, Carrafiello said, he would have advised him to put all contracts in writing and run them by the Law Department.

In the largely circumstantial case, federal prosecutors argue that Green, 70, a Democrat who was sheriff from 1990 to 2010, is guilty of defrauding the public of its right to honest service. They say Green's co-defendant, businessman James Davis, 67, showered him for over a decade with benefits ranging from a bargain-priced house to a job for his wife, in return for contracts worth $35 million.

To support Green over his handling of contracts, defense lawyers Thomas S. McNamara, Lewis Small, and Peter J. Scuderi have relied on an Inquirer investigative article from 15 years ago that first exposed the office's reliance on doing business without documentation. Headlined "Handshake deals, hefty fees," the story quoted a spokesman for the Law Department as saying the sheriff, unlike others in city government, could adopt only oral contracts.

In testimony last week, Daniel W. Cantu-Hertzler, a veteran city lawyer and the Law Department's expert on contracts, said that the spokesman's statement in the article was incorrect and contradicted what the official had been briefed to say. Cantu-Hertzler said there was no exception for the sheriff — the Home Rule Charter requires all contracts to be in writing and to undergo Law Department review.

Responding to the Inquirer's questions in 2003, Green pledged to change his policies and began to put contracts in writing.  However, prosecutors say that in reality Green, after an initial attempt to draft contracts, continued to pile on services and payments to Davis' firms without updating the underlying documents.

Closing arguments in the trial are expected Wednesday.