The late Sen. John McCain's took a final shot at President Trump in his farewell statement to the nation by saying Americans shouldn't hide behind walls.

"We weaken our greatness when we confuse our patriotism with tribal rivalries that have sown resentment and hatred and violence in all the corners of the globe," McCain said in a statement released by his staff Monday. "We weaken it when we hide behind walls, rather than tear them down, when we doubt the power of our ideals, rather than trust them to be the great force for change they have always been."

McCain's final message to the nation is to not despair in our "present difficulties," but to remember the promise of America.

"Do not despair of our present difficulties but believe always in the promise and greatness of America, because nothing is inevitable here. Americans never quit. We never surrender. We never hide from history. We make history," McCain wrote. "Farewell, fellow Americans. God bless you, and God bless America."

Since his campaign, Trump has clamored for hundreds of miles of new border wall to keep illegal immigrants out. Many of Trump's critics have replied by saying the U.S. should be tearing down walls, not building them.

McCain called himself the "luckiest person on earth" because he was able to serve his fellow Americans and the people of Arizona for nearly sixty years.

"My fellow Americans, whom I have gratefully served for sixty years, and especially my fellow Arizonans," McCain wrote. "Thank you for the privilege of serving you and for the rewarding life that service in uniform and in public office has allowed me to lead. I have tried to serve our country honorably. I have made mistakes, but I hope my love for America will be weighed favorably against them."

"Fellow Americans’ – that association has meant more to me than any other. I lived and died a proud American. We are citizens of the world’s greatest republic, a nation of ideals, not blood and soil. We are blessed and are a blessing to humanity when we uphold and advance those ideals at home and in the world," McCain wrote in a statement. "We have helped liberate more people from tyranny and poverty than ever before in history. We have acquired great wealth and power in the process."

McCain passed away at his home in Arizona Saturday. The 81-year-old senator ultimately succumbed to an aggressive battle with glioblastoma, a highly malignant form of brain cancer.

[Former McCain aide: Late senator would have picked a Hispanic woman to succeed him]