Republican Senator John McCain may be on the same side of the aisle as President-elect Donald Trump, but when it comes to Trump's position on torture -- he has a few words of warning.
According to the Associated Press, McCain told a crowd during a panel discussion at the annual Halifax International Security Forum on Saturday, "We will not waterboard," regardless of what "the president of the United States wants to do or anybody else wants to do."
He added, "We will not torture people ... It doesn't work."
Related: See John McCain through the years:
John McCain through the years
John McCain through the years
UNITED STATES - FEBRUARY 27: TV RATINGS--Senate Commerce Committee Chairman John McCain, R-Ariz., during hearing on the TV ratings system. (Photo by Douglas Graham/Congressional Quarterly/Getty Images)
20th August 1992: The Republican Senator from Arizona, John McCain, speaking at the Republican National Convention. A fomer prisoner of war for several years in Vietnam, he contested his party's nomination for the 2000 election. (Photo by Consolidated News Pictures/Getty Images)
HANOI, VIET NAM: U.S. Sen. John McCain, a former POW, looks 31 May 1993 at a display of personal belongings of American POWs at the joint POW/MIA archives center in the Hanoi Army Museum. McCain is with U.S. Sen. John Kerry and a delegation on a two-day visit aimed at obtaining more access to archives dealing with the fate of missing U.S. servicemen. (Photo credit should read HOANG DINH NAM/AFP/Getty Images)
UNITED STATES - MAY 18: MCCAIN'S DAY--Sen John McCain, R-Ariz., relaxes in his office at about 2:15 p.m. (Photo by Scott J. Ferrell/Congressional Quarterly/Getty Images)
UNITED STATES - JUNE 02: McCAIN BILL--John McCain,R-Ariz.,during a press conference on the McCain Bill and tobacco legislation. (Photo by Douglas Graham/Congressional Quarterly/Getty Images)
WASHINGTON, : US Senator John McCain, R-AZ, chairman of the Senate Committee on Commerce, Science and Transportation begins the start of a hearing on the investigation of the scandal surrounding the 2002 Salt Lake City Winter Olympics on Capitol Hill in Washington, DC 14 April, 1999. AFP PHOTO/Mario TAMA (Photo credit should read MARIO TAMA/AFP/Getty Images)
HANOVER, : US Senator John McCain speaks to reporters 27 October,1999 in Hanover, New Hampshire. McCain criticized sugar, oil, and corn (shown behind) subsidies and linked them to 'soft money' campaign contributions. (ELECTRONIC IMAGE) AFP PHOTO Luke FRAZZA (Photo credit should read LUKE FRAZZA/AFP/Getty Images)
MANCHESTER, : Republican president hopeful John McCain greets supporters as he arrives at a debate forum sponsored by a local television station 02 December, 1999, in Manchester, New Hampshire. McCain will debate the other Republican candidates seeking the party's presidential nomination. (DIGITAL IMAGE) AFP PHOTO/John MOTTERN (Photo credit should read JOHN MOTTERN/AFP/Getty Images)
UNITED STATES - CIRCA 2000: John McCain addresses a shadow convention at the Annenberg Center of the University of Pennsylvania. McCain was booed when he asked suppoters to back his former primary opponent, George W. Bush. The shadow convention was put on near the site of the Republican National Convention in Philadelphia to highlight issues that the organizers say the major parties are ignoring. (Photo by Harry Hamburg/NY Daily News Archive via Getty Images)
CAMDEN, UNITED STATES: GOP presidential hopeful US Senator John McCain (R-AZ) waves during an 'Old Fashion BBQ and Stump Meeting' on the front yard of a supporter's house 08 January 2000 in Camden, South Carolina. (ELECTRONIC IMAGE) AFP PHOTO/Paul J. RICHARDS (Photo credit should read PAUL J. RICHARDS/AFP/Getty Images)
PETERBOROUGH, NH - JANUARY 30: Republican presidential hopeful Sen. John McCain (L) and his wife Cindy are showered with confetti following McCain's final town meeting 30 January, 2000 in Peterborough, New Hampshire. (ELECTRONIC IMAGE) (Photo credit should read C.J. GUNTHER/AFP/Getty Images)
GREENWOOD, : Republican presidential hopeful John McCain makes a point 14 February 2000 during a town hall meeting at the American Legion Post 20 in Greenwood, South Carolina. McCain is campaigning heavily in the southern state against Texas Governor Geroge W. Bush ahead of the 19 February 2000 primary. (ELECTRONIC IMAGE) AFP PHOTO/Tim SLOAN (Photo credit should read TIM SLOAN/AFP/Getty Images)
THE TONIGHT SHOW WITH JAY LENO -- Episode 1789 -- Pictured: (l-r) Senator John McCain during an interview with host Jay Leno on March 1, 2000 -- (Photo by: Paul Drinkwater/NBC/NBCU Photo Bank via Getty Images)
UNITED STATES - APRIL 30: Sen. John McCain, R-AZ, at a Senate Commerce, Science and Transportation Committee hearing on climate change. (Photo By Tom Williams/Roll Call/Getty Images)
UNITED STATES - FEBRUARY 12: TEMPORARY GUEST WORKERS--Witness Sen. John McCain, R-Ariz., during the Senate Judiciary Immigration, Border Security and Citizenship Subcommittee hearing titled 'Evaluating a Temporary Guest Worker Proposal.' (Photo by Scott J. Ferrell/Congressional Quarterly/Getty Images)
UNITED STATES - JUNE 28: SENATE POLICY LUNCHES--Sen. John McCain, R-Ariz., talks to reporters after the Senate GOP policy luncheon. (Photo by Scott J. Ferrell/Congressional Quarterly/Getty Images)
WASHINGTON - SEPTEMBER 20: U.S. Senator John McCain (R-AZ) addresses The Northern Virginia Technology Council's Titans breakfast at the Capitol Hilton September 20, 2006 in Washington, DC. McCain spoke on a variety of subjects, including telecommunications legislation, net neutrality, research and development tax credits, immigration, and Internet taxes. He also addressed the rift that he and several other Republican senators are having with the White House over the Geneva Conventions. (Photo by Chip Somodevilla/Getty Images)
KABUL, AFGHANISTAN - JULY 04: US Senator John McCain (C) holds a press conference at ISAF HQ in Kabul, Afghanistan on July 4, 2017. US Senator John McCain visited the headquarters of NATO-led mission after his visit at Pakistan. (Photo by Haroon Sabawoon/Anadolu Agency/Getty Images)
WASHINGTON, July 13, 2017 -- U.S. Senator John McCain is swarmed by reporters as he leaves a meeting on Capitol Hill in Washington D.C. July 13, 2017. Senate Republicans of the U.S. Congress on Thursday unveiled a new healthcare bill that they hoped can fulfill their long-time goal to 'repeal and replace' the Affordable Care Act. (Xinhua/Ting Shen via Getty Images)
Discover More Like This
BACK TO SLIDE
On the campaign trail Trump told supporters he wants to change laws barring waterboarding, a technique used against suspected terrorists during the Bush administration.
McCain was tortured while being held captive during the Vietnam War. He reminded the audience that torture is illegal not just under U.S. law, but under the Geneva Conventions as well.
Trump has been a focus of many of the discussions at the Security Forum which is attended by top defense and security officials from across the world.
Related: Learn more about John McCain's experience in Vietnam:
John McCain military capture and rescue
John McCain military capture and rescue
A photo taken by a French cameraman in 1967 shows US Navy Airforce Major John McCain lying on a bed in a Hanoi hospital as he was being given medical care for his injuries. John McCain was captured in 1967 at a lake in Hanoi after his Navy warplane was downed by the Northern Vietnamese army during the Vietnam War.
P368426 01: (File Photo) Senator John Mccain Is Pulled Out Of A Hanoi Lake By North Vietnamese Army Soldiers And Civilians October 26, 1967 In Hanoi, North Vietnam. Mccain's A-4E Skyhawk Was Shot Down By A Surface-To-Air Missile. Mccain Broke Both Arms And His Right Knee Upon Ejection And Lost Consciousness Until He Hit The Water. (Photo By Getty Images)
P368426 04: (File Photo) Senator John Mccain In A Hanoi Hospital During The Vietnam War November, 1967. (Photo By Getty Images)
P368426 06: (File Photo) A Statue Commemorating October 26, 1967, The Day Lt. Cmdr. John Mccain Was Captured By The North Vietnamese Army, Stands In Hanoi, North Vietnam. (Photo By Getty Images)
P368426 05: (File Photo) A Mug Shot Of Senator John Mccain As A P.O.W. Taken By The North Vietnamese Sometime Between 1967-73 (Photo By Getty Images)
HANOI, VIET NAM: This file picture taken in 1967 shows US Navy Airforce Major John McCain lying on a bed in a Hanoi hospital as he was being given medical care for his injuries. McCain was captured in 1967 at a lake in Hanoi after his Navy warplane was downed by the Northern Vietnamese army during the Vietnam War. One of his rescuers said 24 February 2000, McCain was well treated after being pulled from the lake by villagers. McCain said that upon capture he was beaten by an angry mob and bayoneted in the groin. (B/W ONLY) AFP PHOTO (Photo credit should read AFP/Getty Images)