HARRISBURG — His job, he said, was to figure out who needed cash.

And when he did, he didn't have to try too hard to spread the wealth.

That was how Tyron B. Ali on Thursday described his work as the elusive undercover operative for the state Attorney General's Office who spent more than 18 months secretly recording elected officials taking money or gifts during a high-stakes sting investigation.

Dressed in a crisp dark suit, he took the stand at the bribery trial of State Rep. Vanessa Lowery Brown, one of six Philadelphia Democrats charged in the investigation and the lone defendant to fight the charges. Brown, he testified, willingly accepted the envelopes stuffed with $100 bills that he offered her in exchange for official favors.

"She wanted it," Ali said during questioning by First Assistant District Attorney Michael A. Sprow. "She asked for it."

Ali's testimony has been anticipated for years. The sting's most controversial figure, he has largely stayed out of the public eye since the Inquirer first reported in 2014 that he had been deployed to the state Capitol between 2010 and 2012 and, posing as a lobbyist, had showered lawmakers with cash and gifts.

Details about his whereabouts have been kept under lock. Few know where he has been living or what he does for a living. And on Thursday, Ali provided no new information, sticking to short, straightforward answers about his role in the investigation and the audio and video recordings he made.

What is known is that his cooperation in the sting led to charges against six Philadelphia Democrats, including Brown. The other five — four former state representatives and a former Traffic Court judge — have either pleaded no contest or admitted accepting money or gifts. Brown is accused of accepting $4,000 from him in 2001.

Brown's lawyer, Patrick A. Casey, has argued that Brown was entrapped — and that overzealous prosecutors and agents deployed "a con man" with a repugnant criminal history to pressure her into doing something she didn't want to do.

In cross-examining Ali on Thursday, Casey tore into his alleged motive for becoming an undercover operative for the Attorney General's Office: escaping responsibility in a massive fraud case he was confronting in 2009, in which he was charged with 2,088 counts of forgery, conspiracy, theft, and other crimes. Prosecutors accused Ali of using a child care center he operated in North Philadelphia as a front to defraud taxpayers of $430,000 intended to provide meals for low-income children and seniors.

Under questioning by Casey, who is with the Scranton firm of Myers, Brier & Kelly, Ali attempted to downplay the case, saying the charges were allegations, and telling the jury of seven women and five men that his lawyers had conducted a forensic investigation that recovered the majority of the money he is alleged to have stolen.

Ali's exchange with Casey frequently turned testy.

"I did not take the money from the food program," Ali said as Casey peppered him with questions.

At one point, Ali looked at Casey and said: "Did I make mistakes?" Before he could answer the question, Casey responded: "No, you committed crimes."

Ali is expected to return to the stand Friday, when Casey is expected to continue the cross-examination.

The Inquirer and Daily News have reported that as part of Ali's cooperation agreement, the state Attorney General's Office dropped all 2,088 charges against him. In 2015, Ali agreed to repay $63,000 to resolve the fraud case. At the time, prosecutors said the initial case against him was overblown.

As Ali testified, Brown, who faces bribery and conflict of interest charges, stared stonily at him. In pretrial proceedings, Casey has suggested that Brown believed she and Ali had a romantic relationship, which Ali has denied.

Casey has argued that Brown was targeted because of her race and her political affiliation, but a judge dismissed those objections in pretrial proceedings.

Her attorneys have not said whether Brown, who is running unopposed in next month's election, will take the stand.

Earlier in the day Thursday, Robert Caruso, the head of the state Ethics Commission, testified that Brown did not disclose the money Ali gave her in 2011 on her annual statements of financial interest. But in January 2017 — more than two years after she was charged in the sting — Brown filed an amended form and reported the payments as gifts.