IOWA CITY, Iowa (AP) — In 2007, Matt McCoy was a rising star in the Democratic Party, Iowa's first openly gay senator and a leading champion for the party's causes.

But then, his allies say, McCoy's promising career was stalled by a politically motivated federal prosecution brought by a Republican U.S. attorney, Matthew G. Whitaker, who on Wednesday became the nation's top law enforcement official after President Donald Trump named him acting attorney general.

The case against McCoy fell apart in court amid allegations of political bias and prosecutorial misconduct. A jury quickly acquitted McCoy of the criminal charge, deciding that he had not attempted to extort money from a former business partner.

In an interview Thursday, McCoy said he was shocked by Whitaker's elevation to lead the Justice Department . He said his case should serve as a warning that Whitaker will not hesitate to pursue Democrats and Trump's desire to curtail special counsel Robert Mueller's investigation.

Whitaker said in a statement on Wednesday that he is "committed to leading a fair Department with the highest ethical standards, that upholds the rule of law, and seeks justice for all Americans." Trump said on Twitter that Whitaker "will serve our Country well."

McCoy faced prosecution when Whitaker was a George W. Bush appointee serving as the U.S. attorney for the Southern District of Iowa based in Des Moines. Democrats have alleged that it was one of several prosecutions of local officials brought during the Bush years that were tainted by political considerations — an allegation that Whitaker has denied.

Whitaker announced at a news conference in March 2007 that a grand jury had charged McCoy with attempted extortion by an elected official, an offense that carries a maximum penalty of 20 years in prison. He alleged that McCoy demanded and accepted $2,000 in payments from a businessman seeking to obtain a waiver to sell home security products for the elderly to Iowa's Medicaid program, threatening to block state business if he wasn't paid.

Whitaker's office and the FBI spent months building a case against McCoy after Thomas Vasquez, a salesman with a history of financial, domestic and substance abuse problems, alleged that McCoy was trying to shake him down. Vasquez later agreed to be a paid informant, recording several conversations with McCoy and making what prosecutors called "bribe payments" to McCoy with money supplied by the FBI.

McCoy argued the indictment was based on out-of-context snippets of 12 hours of recorded conversations, and that his actions had an innocent explanation that his legal team shared with Whitaker early on.

In addition to being a senator, McCoy operated a consulting business. He said Vasquez, an acquaintance he met through Alcoholics Anonymous, had asked him to help market the security products as a consultant and he agreed. They signed a contract in which McCoy would be paid $100 for each unit sold. Vasquez went to the FBI after their relationship soured. McCoy said that he later accepted payments from Vasquez because he believed that he was following through with their deal.

His lawyers argued that Whitaker's office committed prosecutorial misconduct by not playing for the grand jury parts of the recordings that were exculpatory — such as declining one payment from Vasquez and directing him to write checks to his company. Whitaker's office denied any wrongdoing. But it did acknowledge that one of its prosecutors made a mistake in withholding information that showed the FBI repeatedly paid Vasquez cash for his cooperation — information that came out weeks before trial and stunned the defense. Vasquez, who had filed for bankruptcy in 2001, testified at a pretrial hearing that he likely used some of the FBI money to buy drugs.

A federal judge declined to dismiss the case, ruling that any problems with the prosecution didn't rise to the high bar needed to grant that remedy.

After a nine-day trial, jurors returned their acquittal within two hours — including a long lunch break. McCoy's supporters cheered outside the courthouse. But by then, McCoy had exhausted all of his liquid assets paying for his defense.

One of his former attorneys, Marc Beltrame, recalled that some jurors felt so bad for McCoy's ordeal that they privately apologized afterward.

The case struck Iowa Democrats and some media observers as an abuse of power.

"Why would the federal government contact, wire and pay an informant without checking him out — or, worse, despite knowing he was disreputable? It has all the earmarks of a politically motivated witch hunt," Des Moines Register columnist Rekha Basu wrote after the acquittal.

Whitaker said in a statement later that he respected the outcome, saying: "All of the evidence was heard by the jury in open court and they have rendered their decision."

McCoy said that he continues to suffer from the reputational damage and is still paying off the $100,000 in legal fees he incurred fighting the charge. When he was considering a run for Congress last year in a seat a Democrat captured in Tuesday's election, a national publication brought his indictment back up in what he called a damaging story. He opted not to run for Congress and campaigned for the Polk County Board of Supervisors instead, ousting its longtime chairman in the Democratic primary earlier this year.

McCoy said he believes Whitaker pursued him in part because of his openly gay lifestyle. He noted that Whitaker was a keynote speaker while he was U.S. attorney at an event for the Christian Coalition, which opposes gay rights.

"I'm still carrying this around my neck — both the financial burdens as well as the emotional scars," he said. "This all happened so that Whitaker could have a political trophy on the wall and I was it."

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.