Marylanders are likely to decide referendums in November on gay marriage and on tuition breaks for illegal immigrants that could redefine the state’s political identity.

With polls showing voters almost equally divided on same-sex marriage, which Gov. Martin O’Malley signed into law Thursday evening, Maryland could become the first state to confirm gay nuptials by a popular vote, making it a pioneer alongside Massachusetts, the first state in which a legislature legalized same-sex marriage.

“For a people of many faiths, for a people committed to the principle of religious freedom, the way forward is always found through greater respect for the equal rights of all, for the human dignity of all,” O’Malley (D) said moments before he signed the bill to sustained applause from hundreds of supporters who crowded into the main hall of the State House.

Along with gay marriage, the results of a referendum on the state’s version of the Dream Act could also reverberate nationally as Marylanders weigh in on an issue that has become a cause celebre among Republican presidential candidates.

Taken together, the ballot questions will add up to something else: a referendum on just how liberal Maryland has become.

Although long a blue state, Maryland has, in part because of its location south of the Mason-Dixon line, remained a state with more conservative views than others with similarly sized Democratic majorities.

Its voters have repeatedly preferred the middle of the pack instead of the leading edge, especially when it comes to controversial social policy. The last comparable referendum in the state was a measure to confirm a woman’s right to an abortion in 1992 — nearly two decades after the Supreme Court settled Roe v. Wade.

But a November sweep for gay marriage and immigrant rights would not only further position Maryland as the ideological opposite to neighboring Virginia but also would place it among the nation’s most liberal states.

A third potential ballot measure, which could dramatically expand gambling, may also loom large in the psyche of Maryland voters for its perceived loosening of the state’s moral fiber.

“All of these taken together, it will tell us what Maryland is evolving into — meaning, we may not be the Maryland that we once were or that we thought we still were,” said Sen. C. Anthony Muse (D-Prince George’s). “It will redefine us.”

In the course of that electoral soul-searching, Maryland may in coming months prove too blue for a Democratic president who will have to focus his reelection effort on independent and moderate voters in swing states.

Although Maryland was a backdrop for President Obama on the campaign trail in 2008 — and has been a convenient stop to highlight administrative priorities since — it may not be in coming months if gay marriage and illegal immigration surface every time.

Visits could stir questions about what the president has called his “evolving” views on gay marriage, and on tuition breaks for illegal immigrants, which Republican presidential candidate Mitt Romney has said he opposes.

“Not that I want to be giving the president advice, but he would be wise to stay out of Maryland,” said Del. Anthony J. O’Donnell (R-Calvert), who is running to challenge U.S. House Minority Whip Steny H. Hoyer (D-Maryland).

“I could see a Republican presidential candidate spending more time here than Obama to highlight what the far left of the political spectrum really looks like,” said O’Donnell, noting O’Malley’s proposal to raise income taxes on most state residents making $100,000 or more.

Obama may have another reason to steer clear. He has been heavily courting gay donors to support his reelection, and if the marriage referendum qualifies in Maryland, it and ones that could also appear on ballots in Maine and Washington could become a national cause for gay rights advocates to push Obama to express support for the measures.

Although blacks are expected to turn out again in force to help reelect the nation’s first black president, that third of the electorate in Maryland remains deeply conflicted over gay marriage.

Among Maryland Democrats who are white, 71 percent support same-sex marriage, and 24 percent do not, according to a recent Washington Post poll. Among blacks, 41 percent are supportive, and 53 percent are opposed.

Some black pastors have lobbied for the measure. But last week, ministers of several African American megac hurches in Prince George’s County, as well as conservative and Catholic groups, vowed to help repeal the measure.

On Wednesday, two black Democratic lawmakers from Baltimore and the Maryland Marriage Alliance, a religious group aligned with national anti-gay marriage activists, joined forces with Maryland Republicans to launch a signature-gathering drive to place the measure on the fall ballot.

During a similar ballot fight over gay marriage in California four years ago, black churches served as the power centers to help pass a constitutional ban.

Although it’s nearly impossible that the ballot fights could tilt Maryland for a Republican this year, the rift among Democrats over gay marriage and the other referendums could present a far more complex scenario for Obama in the state than that faced by former president Bill Clinton. During his run in 1992, Democrats in the state were more united in support of the measure to confirm a woman’s right to choose whether to have an abortion.

Mix in competing coalitions on the Dream Act, over which blacks are also split, and efforts to expand gambling, and politicians and strategists say the state could have the most volatile mix of ballot questions in the country.

“It’s impossible to predict,” said Sen. Brian E. Frosh (D-Montgomery). “There are so many crosscurrents and tides, you would have to be a genius to predict today how the electorate will sort itself out on all of this.”

Opponents of gay marriage stressed that much work remains in coming months just to make sure enough signatures are gathered to give voters the opportunity to repeal the gay marriage law.

But foes and supporters agreed that if it qualifies, gay marriage will headline a remarkable ballot.

“It would be massive, gigantic” if it passes, said Kevin Nix, a spokesman for Marylanders for Marriage Equality. Nix said there will be more dynamics to deciding the question than the black-white divide. Proponents are betting on younger voters, who are more accepting of gay marriage, to turn out in large numbers for the presidential election.

“I’m hopeful,” Nix said. “It would be game changer, not just in Maryland, but nationally.”

Del. Neil C. Parrott (R-Washington), who is leading the petition drive, hopes for a tidal wave in the other direction. But either way, he said, “it will be historic. This ballot will have something for everybody and may draw more people to the polls than we’ve ever seen.”