Washington (CNN) President Donald Trump announced unexpectedly Thursday that he is granting a full pardon to Dinesh D'Souza, the conservative author and filmmaker who pleaded guilty to violating federal campaign finance laws in 2014 after he was indicted earlier that year on charges that he illegally used straw donors to contribute to Republican Senate candidate Wendy Long in New York in 2012.

"Will be giving a Full Pardon to Dinesh D'Souza today. He was treated very unfairly by our government!" Trump tweeted.

Will be giving a Full Pardon to Dinesh D'Souza today. He was treated very unfairly by our government! — Donald J. Trump (@realDonaldTrump) May 31, 2018

Trump, who signed the paperwork formally pardoning D'Souza before announcing it on Twitter, had never met or spoken with D'Souza before this week. He told reporters aboard Air Force One Thursday that he called him for the first time Wednesday night to inform him that he would be pardoning him. The two spoke for nearly three minutes, according to the President.

"He almost had a heart attack," Trump said.

In a tweet celebrating his pardon, D'Souza said "(President Barack) Obama & his stooges tried to extinguish my American dream & destroy my faith in America. Thank you @realDonaldTrump for fully restoring both(.)"

Obama & his stooges tried to extinguish my American dream & destroy my faith in America. Thank you @realDonaldTrump for fully restoring both — Dinesh D'Souza (@DineshDSouza) May 31, 2018