Opponents of a new law that gives undocumented immigrants in-state tuition discounts at Maryland’s public colleges have gathered enough signatures to suspend the law and force a statewide referendum, election officials said Thursday.

It is the first time in 20 years that a petition drive has forced a vote on a Maryland law.

Under the law, undocumented immigrants who can prove that they have attended Maryland high schools for at least three years and that their parents or guardians have begun paying taxes were to have been allowed to begin courses this fall at community colleges at in-state rates. The measure was approved in the closing hours of this year’s legislative session after years of failed attempts.

Opponents of the immigrant tuition bill celebrated Thursday, calling the news from the Maryland State Board of Elections a chance to turn back an expensive liberal ideology promoted by the Democratic-controlled legislature.

“This is a great benefit to every citizen of the state,” said Del. Neil C. Parrott (R-Washington), the leader of the petition drive. “The liberal leadership of the General Assembly rammed this through, even with 20 Democrats voting against it. It’s taken the hard work of volunteers across the state to make sure voters will have the final say.”

Elections officials have yet to certify the outcome, and court challenges are likely. But the petition’s success, combined with the House of Delegates’ decision this spring not to approve same-sex marriage, suggests that Maryland is not as socially liberal as its reputation and overwhelming Democratic political structure would suggest.

Conservatives owe part of their success to a first-of-its kind online tool used to connect with like-minded opponents and to avoid the clerical errors that routinely doom signature-gathering drives in Maryland. Signatures can be rejected if they do not match voter rolls, so the tool printed a Maryland voter’s name and information exactly as it is listed in registration records. A petition signer only needed to sign his name as printed and mail it to the petition campaign.

The success of the Internet petition appears poised to have a profound effect beyond the referendum at hand.

“This issue of illegal immigration tapped into a zeitgeist. With the economy, it was ripe to be the first referendum to succeed in 20 years,” said Todd Eberly, a political science professor at St. Mary’s College. “But the way it was done, this will have a major impact, too. Maryland Republicans can now use this as an alternative means to have influence . . . and as a result, same-sex marriage is likely dead in the General Assembly for the near future.”

A bill to legalize same-sex marriage died in the House in April. But a same-sex marriage bill passed in New York last month, and proponents have said they would use that momentum to make the issue a major part of the legislative session in Maryland when the assembly reconvenes in January. But Eberly and others said that may be less likely if the issue appears destined for a referendum, where many same-sex marriage efforts around the country have failed.

Sen. Richard S. Madaleno Jr. (D-Montgomery), an openly gay lawmaker who has sponsored same-sex marriage legislation, disagreed with Eberly.

“I think we should keep in perspective that less than 2 percent of the citizens of this state have signed onto this petition,” he said. “Maryland has a remarkably low petition threshold. You could probably get 2 percent of Virginia to sign onto a petition to be a sanctuary state” for undocumented immigrants.

A coalition of clergy, immigrant rights groups and Democrats who backed the immigrant tuition measure has vowed to scrutinize the validity of signatures and launch court challenges.

Alisa Glassman, lead organizer of one of those groups, Action in Montgomery, predicted Thursday that even if the tuition law proceeds to a referendum, proponents would prevail at the ballot box.

“The language used to gather signatures has for the most part been very narrow, mean-spirited and, at times, racist,” Glassman said. “We believe that once a counter-narrative is put out there, one that speaks to the greater good, the Maryland DREAM Law will prevail.”

For a four-year degree, the plan could cost Maryland $40,000 per student, and state analysts had estimated that hundreds of undocumented high-school graduates would begin applying for aid this summer. Immigrant groups say that those students’ college plans are now in limbo, and that for many, college in the fall may be out of reach financially.

Opponents of the bill said the outcome of the petition effort shows how out of touch the state’s leaders were.

“This is the biggest petition victory in the history of the state . . . and the driving force was the passion and outrage of the people of Maryland,” said Del. Patrick L. McDonough (R-Baltimore County), a lead organizer. “Politicians in Annapolis tried to make this about something it wasn’t.”

McDonough said that more than 50 percent of those who signed the petitions were registered Democrats. He said that the issue would become part of the 2012 election dialogue and that he was sure it would help Republicans in Maryland and elsewhere.

“President Obama has said passing a national DREAM Act is one of his priorities, and when he is in Maryland, he will have to campaign for it. From the success we had in gathering signatures, I expect a big success at the polls, and that will give Obama a bloody nose. And if it fails in Maryland, that will give Gov. [Martin] O’Malley, one of his biggest supporters, a bloody nose, too.”

Opponents needed at least 55,736 signatures, or 3 percent of those who cast ballots in the last statewide election, to push the measure to a vote in November 2012. The board reported Thursday that 63,118 signatures had been validated by local officials. Counting and certifications of signatures will continue for weeks because opponents turned in more than 130,000 signatures. The Board of Elections has until July 22 to certify the total tally.