Nigerians angry about their government’s recent banning of Twitter Inc. have understandably focused their ire on President Muhammadu Buhari: It was Twitter’s decision to take down his tweet implicitly warning separatists that they could suffer the same violent end as former Biafran rebels that prompted the crackdown.

But the Nigerian ban should be a warning to U.S. lawmakers and activists, too. Their efforts to rein in U.S.-based social media giants such as Twitter and Facebook Inc. risk restricting democratic freedoms worldwide.

Antipathy toward the big platforms is rising across the U.S. political spectrum. Democrats blame them for allowing misinformation to flourish; Republicans, for allegedly censoring rightwing voices. Both agree they should be cut down to size: The Democratic chair of the House Consumer Protection & Commerce subcommittee has said "there is a bipartisan agreement that the status quo is just not working.”