The courts played the role that the majority allowed them to play, just like they did for the hundreds of years during which even same-sex sexual activity was illegal, let alone gay marriage.
Like a diet that sometimes prevents people from eating what they crave, the system is nothing more than a mechanism of self-control for the majority.