President Donald Trump lashed out at Paul Ryan late Thursday on Twitter following the release of excerpts from an upcoming book in which the former speaker of the House criticized Trump for not knowing "anything about government."

Shortly after CNN covered Ryan's comments about Trump in Tim Alberta's "American Carnage," which details how Republicans have changed with Trump's rise to the presidency, Trump responded with a series of insults in three tweets.

"Paul Ryan, the failed V.P. candidate & former Speaker of the House, whose record of achievement was atrocious (except during my first two years as President), ultimately became a long running lame duck failure, leaving his Party in the lurch both as a fundraiser & leader," Trump said in his first tweet.

'This is as bad as it gets':Book 'American Carnage' details Paul Ryan, Reince Priebus relationship with Trump

Ryan reportedly told Alberta that he couldn't stand another two years with Trump and called retirement an "escape hatch," according to excerpts obtained by The Washington Post.

Trump also said Mitt Romney's bid for president in 2012 was doomed after he chose Ryan as his running mate. Trump further criticized Ryan for failing to secure funding for a U.S.-Mexico border wall.

"He had the Majority & blew it away with his poor leadership and bad timing," Trump said in his third tweet. "Never knew how to go after the Dems like they go after us. Couldn’t get him out of Congress fast enough!"

Ryan did not run for reelection in 2018, and Nancy Pelosi succeeded him as speaker after Democrats won control of the House.

Paul Ryan on 2020:Some Democrats could defeat Trump

In Alberta's book, Ryan also characterized Trump as uneducated about the government.

"I told myself I gotta have a relationship with this guy to help him get his mind right," Ryan said, according to The Washington Post. "Because I'm telling you, he didn't know anything about government. ... I wanted to scold him all the time."

An excerpt of the book also details how Ryan wanted to excommunicate Trump after the "Access Hollywood" tape was released during the campaign.

"This is fatal," he told Reince Priebus, then chairman of the Republican National Committee. "How can you get him out of the race?"