Sen. John McCain said on "The O'Reilly Factor" tonight that he understands why Donald Trump's remarks on illegal immigration have struck a chord with many Americans.

McCain said that President Obama, who promised border security, is to blame for the country's immigration woes, since he has not taken action.

The Arizona senator noted that the Senate, on the other hand, did take action, voting for $6.5 billion to be spent on border security and the hiring of 20,000 additional border patrol agents.

O'Reilly said that many Americans are tired of talk coming from the White House and Congress, but no results. That's why Trump's message is resonating, he said.

McCain agreed that many people desire a solution to the illegal immigration problem, and Trump is speaking to that.

"There is nothing wrong with that point of view," McCain said, noting that his state has a major problem with illegal immigration.

"I am saying the solution is there. We passed it through the United States Senate, and we need to act and act as rapidly as possible."

Watch the "O'Reilly Factor" interview above.

WATCH: Trump Says Media 'Messed Up' POW Remark; Meghan McCain Fires Back

Watch Kate Steinle's Dad Deliver Emotional Testimony at Senate Hearing

O'Reilly Calls Out Presidential Candidates Who Don't Support 'Kate’s Law'