WASHINGTON (Reuters) - President Donald Trump said on Friday that he was disappointed that a conservative faction in the House of Representatives blocked his healthcare legislation and said “we learned a lot about loyalty” from the effort.

Speaking in the Oval Office after a stunning political setback, Trump said the healthcare effort was a victim of stalwart Democratic opposition and any future healthcare legislation would likely need Democratic support.

He also said he was surprised and disappointed by the opposition from the House Freedom Caucus, a group of conservatives who prevented Republicans from using their majority in the House to pass the legislation.

Asked if he felt betrayed by the Freedom Caucus, Trump said he did not.

“No, I’m not betrayed. They’re friends of mine. I’m disappointed because we could have had it. So I’m disappointed. I’m a little surprised, to be honest with you,” Trump said.

“We really had it. It was pretty much there, within grasp. But I’ll tell you what’s going to come of it is a better bill...because there were things in this bill that I didn’t particularly like. If both parties could get together and do real healthcare, that’s the best thing,” he said.

Trump, a New York businessman who won election Nov. 8 based in part on promises to get big deals through Congress, cast the failure as a learning experience.

Slideshow ( 3 images )

“We all learned a lot. We learned a lot about loyalty,” Trump said. “We learned a lot about some very arcane rules in obviously both the Senate and the House.”

Trump also expressed confidence in House Speaker Paul Ryan, who was seen as the main backer of the legislation. Ryan personally delivered the news earlier in the day to Trump that there were not enough votes to pass it.

“I like Speaker Ryan. He worked very, very hard. A lot of different groups. He’s got a lot of factions. And there’s been a long history of liking and disliking, even within the Republican Party, long before I got here,” he said. “I’m not going to speak badly about anybody within the party.”

Trump has privately told confidants he wished he had done tax reform first instead of getting immersed in the difficult effort to overhaul President Barack Obama’s signature healthcare law, which passed without Republican support in 2010.

“We’ll probably be going right now for tax reform,” Trump said, saying he wanted “big tax cuts and tax reform. That will be next.”