Washington (CNN) President Donald Trump went after House Speaker Paul Ryan on Wednesday, saying one of the top Republican leaders in the President's party "knows nothing about" birthright citizenship and "should be focusing on holding the Majority" in the House of Representatives "rather than giving his opinions" on the issue.

The comments come a day after Ryan threw cold water on the President's assertion that he can use executive action to end the constitutional guarantee of citizenship to anyone born in the United States.

Ryan told a Kentucky radio station Tuesday that "you cannot end birthright citizenship with an executive order," following remarks from the President indicating that Trump believes he can do just that, though many legal scholars disagree.

On Wednesday, the President tweeted , "Paul Ryan should be focusing on holding the Majority rather than giving his opinions on Birthright Citizenship, something he knows nothing about! Our new Republican Majority will work on this, Closing the Immigration Loopholes and Securing our Border!"

An aide to Ryan declined to comment to CNN on the President's tweet.

Separately, a senior GOP aide defended Ryan when asked about Trump's tweet.

"This is a great way to screw up the message a week before the election," this aide told CNN. "First the birthright comment itself and now attacking the top Republican in Congress who is trying to save our majority."

Trump repeated his claim that he can eliminate birthright citizenship via executive order later Wednesday, although he said his preference would be for Congress to pass legislation ending that constitutional right.

"I believe you can have a simple vote in Congress," Trump told reporters as he left the White House. "You can do it through an executive order."

"I'd rather do it through Congress because that's permanent, but we can certainly do it through -- I really (believe) we can do it through executive order," he added, noting he had discussed the issue with legal scholars.

The President referenced an immigration executive order signed by his predecessor -- the Deferred Action for Childhood Arrivals policy he had sought to undo. Trump suggested that if former President Barack Obama could execute such an order, he could end birthright citizenship through executive action as well. Trump and other Republicans at the time decried Obama's move as defying federal law.

"If President Obama can get DACA approved ... we can do this by executive order," Trump said.

Ryan, who is leaving Congress at the end of his term in January, has been helping to campaign for Republicans as the midterms approach, including both vulnerable incumbents and new candidates in competitive races. When he spoke to radio station WVLK on Tuesday, he was in Kentucky campaigning for Republican Rep. Andy Barr, who is trying to hold onto his House seat.

During the interview on Tuesday, Ryan quickly sought to emphasize common ground with the President on immigration policy, despite saying that it was not possible to end birthright citizenship via executive order.

"Where we obviously totally agree with the President is getting at the root issue here, which is unchecked illegal immigration," Ryan said. "We -- House Republicans and this President -- are in total agreement on the need to stop illegal immigration, to secure our border and fix our laws."

The midterm elections, where Republicans are at risk of losing their majority in the House, take place next Tuesday.

Republicans are viewed as more likely to retain the Senate than the House and Democratic leaders are projecting confidence that they will win the lower chamber of Congress.

House Democratic Leader Nancy Pelosi predicted on Tuesday night that Democrats will take back the House, saying during an interview with late-night host Stephen Colbert, "We will win."

This isn't the first time Trump has lashed out at Ryan.