A doctor who performs abortions at a hospital in Washington filed a federal civil rights complaint on Monday, charging that the hospital had violated the law by forbidding her, out of concerns for security, to speak publicly in defense of abortion and its role in health care.

The doctor, Diane J. Horvath-Cosper, 37, an obstetrician and gynecologist, has in recent years emerged as a public advocate, urging abortion providers not to shrink before threats. Last December, her complaint says, officials of the MedStar Washington Hospital Center imposed what she described as a “gag order,” but what the officials termed a sensible precaution against anti-abortion violence.

At odds in the case are sharply conflicting visions of how best to protect abortion providers and patients. The dispute comes at a time when legal restrictions on the procedure are tightening, many clinics are besieged daily by hostile protesters and an extremist fringe has sometimes made murderous attacks.

Dr. Horvath-Cosper is part of a national movement of physicians and other medical staff members who argue that silence about their work only feeds the drive to stigmatize and restrict abortion. Similar sentiments among some patients have led to a “Shout Your Abortion” campaign on social media.