WASHINGTON (Reuters) - Michael Cohen, U.S. President Donald Trump’s former personal lawyer, said on Thursday he paid a firm to manipulate online polling data “at the direction of and for the sole benefit of” Trump.

The Wall Street Journal reported that Cohen had paid the data firm RedFinch Solutions to manipulate two public opinion polls in favor of Trump before the 2016 presidential campaign.

“As for the @WSJ article on poll rigging,” Cohen wrote on Twitter on Thursday, “what I did was at the direction of and for the sole benefit of @realDonaldTrump @POTUS. I truly regret my blind loyalty to a man who doesn’t deserve it.”

The attempts to influence the polls ultimately proved largely unsuccessful but shed a light on the tactics of the Trump campaign and Cohen’s role within it. On the campaign trail, Trump frequently referred to his polling numbers to help fuel his candidacy.

Cohen was sentenced last month to three years in prison for his role in making illegal hush-money payments to women to help Trump’s campaign and for lying to Congress about a proposed Trump Tower project in Russia.

Cohen has said Trump had directed him to commit the campaign-finance violations, which Trump has denied.

The Journal said Cohen commissioned John Gauger, who runs RedFinch Solutions, to write a computer script to repeatedly vote for Trump in a February 2015 Drudge Report poll on potential Republican candidates. The move came as Trump was preparing to enter the 2016 presidential election race, the newspaper reported.

Trump ranked fifth in the Drudge Report poll, with about 24,000 votes, or 5 percent of the total, according to the Journal.

Cohen also commissioned Gauger to do the same for a 2014 CNBC online poll identifying the country’s top business leaders, although Trump was unable to break into the top 100 candidates, the Journal reported.

“The president has no knowledge of the polls being rigged,” Trump lawyer Rudy Giuliani said in an interview with Reuters.

Trump tweeted about a CNBC poll on business leaders in 2014, calling it “a joke” and suggested he was removed from the list because of “politics.”

Reuters was not immediately able to confirm the details of the newspaper report. Cohen did not immediately respond to a request for comment, and neither did representatives for RedFinch Solutions and the Trump Organization. Charles James, a lawyer for Gauger, declined to comment.

Gauger said Cohen paid him in cash out of a blue Walmart bag, although not for the total amount he was owed. Cohen also promised Gauger work on the Trump campaign that never materialized, according to the Journal.

Cohen worked for Trump for many years as his self-proclaimed fixer, and once said he would take a bullet for Trump.

But the relationship has since publicly soured. Trump has called Cohen a “rat,” while Cohen has cooperated with U.S. Special Counsel Robert Mueller’s investigation of links between the Trump campaign and Russia during the campaign. Both Trump and Moscow have denied any wrongdoing.

Cohen has also agreed to testify publicly in front of the House of Representatives’ Oversight Committee in a hearing scheduled to take place next month.