Washington (CNN) President Barack Obama told CNN's Jake Tapper Wednesday that members of Congress made a "political vote" by voting overwhelmingly to override his veto of a measure that allows families of those killed during the 9/11 terror attacks to sue Saudi Arabia.

"It's an example of why sometimes you have to do what's hard. And, frankly, I wish Congress here had done what's hard," he said in a CNN town hall before a military audience set to air at 9 p.m. ET.

"If you're perceived as voting against 9/11 families right before an election, not surprisingly, that's a hard vote for people to take. But it would have been the right thing to do ... And it was, you know, basically a political vote," Obama said, adding that Gen. Joseph Dunford, chairman of the Joint Chiefs, and Defense Secretary Ash Carter said the legislation was a bad idea.

The override is the first of Obama's presidency -- and was supported by lawmakers from both parties. The Senate approved the override on a 97-1 vote with Minority Leader Harry Reid the lone member to sustain the President's veto. Hours later, the vote in the House was 348-77, with one Democratic member voting "present."

Obama called Congress' move a "mistake."

"I understand why it happened. Obviously all of us still carry the scars and trauma of 9/11. Nobody more than this 9/11 generation that has fought on our behalf in the aftermath of 9/11," he said.

Obama said the victims deserve support and compensation, which is why the administration set up a victim's compensation fund. But he said he doesn't believe the ability to sue Saudi Arabia will be good for the long term future of the US.

"What this legislation did is it said if a private citizen believes that having been victimized by terrorism -- that another country didn't do enough to stop one of its citizens, for example, in engaging in terrorism -- that they can file a personal lawsuit, a private lawsuit in court," he said. "And the problem with that is that if we eliminate this notion of sovereign immunity, then our men and women in uniform around the world could potentially start seeing ourselves subject to reciprocal laws."

He added that the US has set up what is called "status of forces agreements" that ensure that when the US deploys troops, they're not vulnerable to these kinds of private lawsuits. And other countries agreed to do that because the US reciprocated with them.

"The concern that I've had has nothing to do with Saudi Arabia per se or my sympathy for 9/11 families," Obama said. "It has to do with me not wanting a situation in which we're suddenly exposed to liabilities for all the work that we're doing all around the world."