By Terry Baynes

(Reuters) - A federal judge on Monday upheld a controversial Texas law that asks abortion providers to play pregnant women the sounds of the fetal heartbeat, saying an appeals court ruling obliged him to enforce it.

U.S. District Judge Sam Sparks, who had previously blocked parts of the law, said he was forced to follow a federal appellate court's ruling last month that ordered its immediate enforcement.

The law, enacted in 2011, requires abortion providers to perform an ultrasound on pregnant women, show and describe the image to them, and play sounds of the fetal heartbeat. Though women can decline to view images or hear the heartbeat, they must listen to a description of the exam.

A coalition of medical providers sued state officials in June, arguing that the law made doctors a "mouthpiece" for the state's ideological message. The First Amendment includes protections against compelled speech.

Sparks had previously ruled that the law violated physicians' free-speech rights and temporarily blocked the law, but a three-judge panel of the U.S. Court of Appeals for the 5th Circuit overturned the temporary ban in January.

The panel ruled that doctors could be required to provide information that is truthful, not misleading and relevant to the decision to have an abortion.

Sparks upheld the law on Monday out of deference to the higher court. Yet he criticized the appellate court for "making puppets out of doctors" and stripping them of First Amendment rights.

The Center for Reproductive Rights is seeking a rehearing before the full 5th Circuit.

"It is a terrible injustice that Judge Sparks could not rule in favor of protecting the constitutional rights of Texas doctors because of the Fifth Circuit panel's decision," Nancy Northup, president of the Center for Reproductive Rights and a lawyer for the providers, said in an emailed statement.

So far, six states have passed laws requiring abortion providers to perform an ultrasound on each woman seeking an abortion and provide the woman an opportunity to view the image, according to the Guttmacher Institute in Washington, which studies reproductive health issues.

While most of those states allow women to decline to view the image, Texas, Oklahoma and North Carolina require women to hear the provider's verbal description of the ultrasound.

The laws in Oklahoma and North Carolina are temporarily unenforceable, pending court challenges.

(Reporting By Terry Baynes; Editing by Tim Gaynor)