ANNAPOLIS - Gay-rights groups vowed to take their fight to the Maryland legislature Tuesday after the state's highest court upheld a state law banning same-sex marriage.

The 4-3 decision by the Court of Appeals overturns a lower court's January 2006 ruling that said the law infringes on the rights of same-sex couples.

But the high court said the state's Equal Rights Amendment was meant to prevent discrimination based on gender, not sexual orientation, and that the state law defining marriage as between a man and woman has the "legitimate interest" of promoting child-rearing in traditional households.

"The court's words, as disappointing as they are, are not the final word," said David R. Rocah, an American Civil Liberties Union lawyer who was involved in the case. "The question now moves to the legislature."

Sen. Gwendolyn T. Britt and Delegate Victor R. Ramirez, both Prince George's County Democrats, have said they will sponsor same-sex marriage bills in next year's General Assembly.

Delegate Don Dwyer Jr., R-Anne Arundel, said Tuesday that he will propose a constitutional amendment for the fourth year in a row that defines marriage as between a man and a woman.

"This has been an ongoing battle, and the decision out of the court today has been a tremendous victory for the values-oriented families across the state of Maryland," Dwyer said.

The Court of Appeals' ruling closes a lawsuit filed by nine same-sex couples and one gay man in July 2004. The couples sued after court clerks around the state rejected their applications for marriage licenses in June and July 2004.

The clerks said they were bound by state law to reject the license applications. But the lawsuit, filed in Baltimore City Circuit Court, claimed the law violated Article 46 of the state's Declaration of Rights, which says equal rights "shall not be abridged or denied because of sex."

The circuit court ruled in favor of the couples, but an appeal by the state sent the case to the high court, which reversed the lower court.

Judge Glenn T. Harrell Jr. wrote in the majority opinion that the Equal Rights Amendment was intended to "combat discrimination between men and women as classes," not discrimination based on sexual orientation.

But Harrell's opinion invited the legislature to change the law if it wants to. He said the court's ruling "should by no means be read to imply that the General Assembly may not grant and recognize for homosexual persons civil unions or the right to marry a person of the same sex."

In one of two dissenting opinions, Chief Judge Robert M. Bell wrote that the issue is "not whether a same-sex marriage, with all the pejorative emotions that evokes, is a fundamental right; the real issue in this case, when properly framed, is whether marriage is a fundamental right."

Lisa Polyak, one of the lawsuit's 19 plaintiffs, called the court's decision "needlessly cruel." Polyak said that she and Gita Deane, her partner of 23 years, have "no legal connection" to their 8- and 11-year-old daughters because she and Deane are not legally married.

Without legal recognition of same-sex marriages, gay couples lack many of the rights afforded married couples, such as sharing health benefits and visiting each other in the hospital during emergencies. Absent a proper will, they do not have the same inheritance rights that married couples do.

"We will not ask for anything less than full legal equality," said Dan Furmansky, director of Equality Maryland, which participated in the lawsuit.

Religious leaders in the state, meanwhile, celebrated the decision.

"The court made a significant and wise judgment to protect the vital institution of marriage, and we applaud its decision," said Richard J. Dowling, executive director of the Maryland Catholic Conference.