Certainly belongs in Se.Po, it's a core concern of politics, IMO.
In a mature democracy, not necessarily including, but not excluding either, one like Rojava, evolving under the stress of a warzone, the answer is that you can't, unless the democratic majority devolves power to a system that is, at least somewhat, or short-term, independent of their own desires.
This system, be it a Constitution, Charter of Rights, or Supreme Court, or a combination thereof, becomes a deciding point for each citizen if the proposed law or action is acceptable when invoked.
The US Constitution with the tension between either 2nd Amendment, or the notion of Supreme Court enlargement (aka packing). Neither party is happy but the general idea, that a different, orthogonal, decision framework gets to be the arbiter is firmly rooted.
Gay Marriage in Canada for example. Gay Legalizing gay marriage may or may not have been popular when it was first announced but very quickly people got to examine their beliefs in opposing it. Was it worth opposing the core belief of what a country was established on?
Similarly you have the Swiss Federal court ruling, that AppenZellAppenzell did not, despite alla majority of the eligible (male) voters wanting to keep women's vote out, constitute an ethically and legally viable way for a Canton to proceed. And that despite Switzerland being the poster child for, very mature, very stable, very ongoing, direct democracy.
But make no mistake, Supreme Courts and assorted sundry do not, and maybe should not, typically range far forward of what a democracy's electors approve of. When it comes to treating minorities, a Supreme Court is not a guarantor of rights.
This type of mechanism can also prod a politician into "doing the right thing" which would apply to the Eisenhower example. Re. Canada's Trudeau and perhaps the Syrian refugees, Canada's rather low admittance number, 35k IIRC, was not all that unpopular - it wasn't going on a huge political limb.