A federal judge ordered the detention of a Russian gun-rights activist accused of conspiring to cultivate relationships in the U.S. with influential conservatives and gun-rights groups to advance Moscow’s agenda.

Maria Butina, 29 years old and wearing a jail jumpsuit, sat quietly through a nearly two-hour bail hearing on Wednesday before U.S. Magistrate Judge Deborah Robinson, who ultimately sided with federal prosecutors and said she should be held without bond pending trial because she posed a flight risk.

In...