SAN FRANCISCO — The U.S. Court of Appeals for the Ninth Circuit sounded ready Wednesday to uphold a state law that bans psychotherapists from trying to change minors’ sexual orientation.

During nearly two hours of argument before a packed courtroom, attorneys for the therapists argued that the law violates free speech and religious rights. But the judges seemed likely to hold that the state has broad powers to regulate medical care — even if it’s exclusively based on talking — when it’s provided to minors.