President Donald Trump issued a full pardon Thursday to conservative author and filmmaker Dinesh D’Souza, who pleaded guilty in 2014 to violating campaign finance laws.

"Mr. D'Souza was, in the president's opinion, a victim of selective prosecution for violations o campaign finance laws," White House press secretary Sarah Huckabee Sanders said in a statement.

Trump announced his plan to pardon D'Souza in a tweet Thursday morning, writing that the conservative commentator had been "treated very unfairly by our government!"

D’Souza was sentenced in 2014 to serve five years of probation following his guilty plea. Then-U.S. Attorney for the Southern District of New York Preet Bharara said in a statement after his sentencing that D’Souza “attempted to illegally contribute over $10,000 to a senate campaign, willfully undermining the integrity of the campaign finance process.”

“Like many others before him, of all political stripes, he has had to answer for this crime -- here with a felony conviction,” Bharara said.

D’Souza slammed Bharara, who was fired by Trump in March 2017, and thanked his supporters Thursday on Twitter.

“My heartfelt thanks to those who prayed for me, supported me & reached out on social media to President Trump to pardon me,” he wrote.

D'Souza, a frequent critic of former President Barack Obama, initially claimed he had been singled out for prosecution because of his politics. He penned the 2010 bestseller "The Roots of Obama's Rage" and claimed that the former president was pushing the "anticolonial" agenda of his father, a Kenyan economist, according to a 2014 report from The New York Times.