President Barack Obama railed against Senate Majority Leader Mitch McConnell (R-KY) and other Senate leaders on Thursday for refusing to consider his Supreme Court nominee to replace late Justice Antonin Scalia.

Obama said during a town hall at the University of Chicago Law School that Senate Republicans’ refusal to consider D.C. Circuit Judge Merrick Garland for the high court was “unprecedented.”

Obama said he thought it was “perfectly acceptable” for Republicans not to appoint Garland based on disagreements on “important issues.”

“What’s not acceptable is not giving him a vote, not giving him a hearing, not meeting with him. What’s not acceptable, I believe, is the increasing use of the filibuster for someone who’s clearly within the mainstream,” Obama said. “Or to essentially say that we are gonna nullify the ability of the President who is from another party from making an appointment. And we’re gonna wait to maybe see we can get a guy from our party to make the appointment.”

“That is where you have a process foul that corrodes the ability of the court to function effectively,” Obama continued.

Many Republican senators have said they won’t meet with Garland, but there have been a handful of exceptions. McConnell has said that he would not meet with Garland or offer him a hearing.

Obama called Congress “throughly unproductive” and told the law students that the “sharp polarization” seen in the 2016 election cycle would seep into the judicial system if things didn’t change.

Obama walked the students through a scenario in which a Republican won the White House, but Democrats stalled on that Republican president’s nomination.

“If in fact Mitch McConnell sticks to not giving a hearing and not giving a vote and let’s say from their perspective, everything works out great, and their nominee, whoever that might be, wins and takes over the White House,” Obama hypothesized. “So now the Democrats say, ‘Well you know what’s good for the goose is good for the gander.’ We’ll wait four more years to see how the next president comes in. At which point Mitch McConnell will then eliminate the filibuster possibility for Supreme Court nominations as it was eliminated for the other judicial appointments.”

Obama said it would be a “disaster” for courts if there was a continued trend of different parties controlling the Senate and White House.