Maryland Gov. Martin O'Malley signed into law yesterday a measure that would circumvent the Electoral College by awarding the state's electoral votes to the presidential candidate who wins the most votes nationwide.

The bill, one of 105 signed by the Democratic governor the day after the General Assembly adjourned, makes Maryland the first in the nation to agree to let the national popular vote trump statewide preference. It would not take effect until states that cumulatively hold 270 electoral votes -- the number needed to win a presidential election -- agree to do the same.

Yesterday's bill-signing ceremony also offered the governor a chance to bask in the praises of the legislature's presiding officers, two powerful politicians not particularly fond of one another, despite a shared party label. O'Malley's first legislative session was at times an exercise in patience as he sought to navigate between House Speaker Michael E. Busch (D-Anne Arundel) and Senate President Thomas V. Mike Miller Jr. (D-Calvert).

But yesterday Busch thanked the new governor for the collegial tone he set during the 90-day session. Miller went further, suggesting that O'Malley's personality was responsible for the session's successes -- and offering a plug for a live compact disc recorded by O'Malley's Celtic rock band.

"It's a very enjoyable CD," Miller said before the three men put their signatures on bills to set up a government accountability program called StateStat and to create a "sub-Cabinet" to coordinate growth plans for thousands of people moving to the state as a result of the federal base realignment and closure process.

Another bill O'Malley signed into law authorizes the state retirement and pension system to divest from companies doing business in Sudan, where the government has been linked to human rights violations in the country's Darfur region. The bill, O'Malley said, makes "clear our commitment to peace and justice in Darfur."

Supporters of the Electoral College measure, including O'Malley, say deciding elections by popular vote would give candidates reason to campaign nationwide and not concentrate their efforts in "battleground" states, such as Ohio, that have dominated recent elections.

During debate, opponents argued that election by popular vote could just switch the target for candidates from closely divided states to large cities -- a scenario that would not necessarily empower Maryland. And they suggested a national recount could be chaotic.

Yesterday's event was the first of four planned bill-signing ceremonies, and O'Malley touted other measures that will be signed later, including bills to toughen emission standards on automobiles and to freeze college tuition for the next school year.

He also put in a plug for "that spirit of compromise and consensus" that he said his administration brought back to Annapolis after four years under the state's first Republican governor in a generation, Robert L. Ehrlich Jr.

"This is a session where we found consensus in order to advance the common good," O'Malley said.

The months ahead could provide a much tougher test of that proposition than O'Malley's first three as he and legislators tackle a projected $1.5 billion deficit in the state's fiscal year budget that starts in July 2008. Legislative leaders acknowledge that the task -- largely avoided this session -- will involve spending cuts, tax increases and the possible legalization of slot-machine gambling.

"I know we have a lot of tough days ahead of us," O'Malley said. "We're going to tackle tough challenges in the months and years ahead having to do with Maryland's fiscal health. . . . But we have it within us to be able to tackle these challenges. We absolutely, positively do."

Miller later made the same point to reporters, but in more bombastic terms. "There's going to be much wailing and much gnashing of teeth, but it's going to happen," he said.

It's not entirely clear how the "big three," as they are known in Annapolis, plan to get from here to there. Aides have said O'Malley plans to tour the state later in the year to help educate the public about the magnitude of the problem, which was barely mentioned during his campaign last year against Ehrlich.

House leaders have suggested the need for budget summits, and yesterday Busch noted that the House had passed a billion-dollar tax package in 2004 that was scuttled by the Senate, which preferred to legalize slots.

"I think we're appropriately preparing to debate," Busch said.

Other lawmakers suggest that O'Malley will have to bring together Busch, a slots foe, and Miller, one of its biggest champions, to come up with a revenue package.

"Who's the only one that can reconcile the two of them? None of us," said Sen. Richard S. Madaleno Jr. (D-Montgomery).