A measure to legalize same-sex marriage in Maryland advanced Tuesday to the full House of Delegates, where a pitched fight — with a still-uncertain outcome — is expected in coming days over one of Gov. Martin O’Malley’s leading priorities.

A pair of House panels jointly approved the bill 25 to 18, after Democratic delegates turned back an attempt to substitute civil unions for marriage and Republicans complained about the un­usual step of having two committees vote together.

Supporters, who hailed the measure as an advance in equal rights, said they were cautiously optimistic it would pass the full House — where a similar bill died last year after narrowly clearing the Senate.

“It’s close, but I think it’s going to pass,” predicted House Majority Leader Kumar P. Barve (D-Montgomery).

Del. Don H. Dwyer Jr. (R-Anne Arundel), a leading opponent of the bill, warned that the legislation would hurt children and families and vowed “a floor fight on the most important issue facing the state.”

The vote came as O’Malley (D) waged a Valentine’s Day charm offensive on other shaky parts of his legislative agenda.

In appearances before two legislative panels, the governor pressed his case for an unpopular tax hike on gasoline and for costly environmental efforts that he billed as critical for the state to move toward a “cleaner, greener” future.

Perhaps no other O’Malley effort is being watched as closely nationally as same-sex marriage. Maryland would join the District and eight states that have legalized gay nuptials — most recently New York and Washington state.

Underscoring how closely divided the House remains, O’Malley has been reaching across the aisle in recent weeks to Republican lawmakers.

On Tuesday, one GOP delegate — Robert A. Costa (Anne Arundel) — joined 24 Democrats in voting to send the bill to the floor. One Democrat — Sam Arora (Montgomery) — did not vote.

Impassioned pleas came from both sides. In arguing against substituting civil unions for marriage, Del. Bonnie Cullison (D-Montgomery), one of seven gay lawmakers in the chamber, told her colleagues such a measure would be “about making sure we stay different.”

Opposing the bill, Del. Michael J. Hough (R-Frederick) said, “Marriage has been between one man and one woman since the beginning of time.”

The bill was jointly considered by the Judiciary Committee, which had sole jurisdiction last year, and the Health and Government Operations Committee. If only the Judiciary votes had been counted, the measure would have failed.

The day amounted to the most pivotal yet for O’Malley’s legislative agenda.

First appearing Tuesday in a blue tie, O’Malley changed to a bright red one and circled the state capital, pleading with Washington area business leaders to stand behind his proposed gas-tax increase. In a rare move, the governor then testified personally before lawmakers weighing three of his environmental initiatives.

O’Malley told the Senate’s environmental committee that doubling revenue from the so-called “flush tax” and putting limits on housing developments supported by septic systems were crucial to ensure future generations could enjoy a cleaner Chesapeake Bay.

The governor also cast in sweeping terms his plan to force every electricity ratepayer in the state to share in the cost of subsidizing development of an offshore wind farm. “This goes to the heart of what we’re debating as a country,” O’Malley said. “There comes a point at which if we let everybody get out of the things we need to do, we don’t have the wherewithal or the dollars to do the things we need to do.”

The governor, however, faced a skeptical audience in the Senate Finance Committee, with both Republican and Democratic lawmakers saying they remained concerned about the costs and safeguards of O’Malley’s wind plan.

Republicans, led by Senate Minority Leader E.J. Pipkin (Cecil), asked why Maryland would succeed in such an effort when Massachusetts, Delaware and others have faced repeated setbacks. No offshore wind farm has yet been built off the United States.

The governor also implored the friendly crowd he found in the board of directors of the Greater Washington Board of Trade to stand behind his gas-tax plan.

That bill, which the governor formally introduced Tuesday, calls for applying the state’s 6 percent sales tax to gas, which at current prices would increase the cost about 18 cents per gallon. The tax would be phased in over three years. O’Malley stressed that the bill would have a “braking mechanism”; if gas prices increase more than 15 percent in any of the next three years, the stepped increase for that year would be delayed.

O’Malley also said the plan would restore to counties about 40 percent of the money the state has cut off in recent years for local highway improvements. That measure quieted some critics, though they said the governor still has work to do to sell the plan to the public.

Staff writer Greg Masters contributed to this report.