With teachers' paychecks about to bounce, city leaders completed yesterday a $42 million loan that would keep classrooms open and give Mayor Martin O'Malley more control over Baltimore schools.

Approved over the city comptroller's objections and with a last-minute concession to the City Council, the loan came a week before the school system would have run out of cash.

The deal avoids a virtual state takeover of Baltimore schools but will drain the city's rainy-day fund to $14 million, a move that will likely lead to a downgrade of city bonds by at least one ratings agency. The loan was approved on the day that city finance officials gave a bleak assessment of Baltimore's financial state, saying fee increases and more than 500 municipal job cuts would be needed to balance the city's next budget.

Those troubles are unrelated to the school aid, said O'Malley, who expressed confidence that the city loan was the way to keep schools solvent.

"We are going to succeed," O'Malley said. "Failure is not an option."

School officials said they were grateful for the help and willing to abide by terms, summarized in a 14-page financial recovery plan, requiring greater financial accountability to the city.

"Thanks for taking a chance on us because we have not demonstrated fiscal accountability as we should have," school board Chairwoman Patricia L. Welch said after the Board of Estimates voted 4-1 for the deal. "But it is a new day."

Schools chief Bonnie S. Copeland, who is grappling with a $58 million deficit and a separate $58 million cash-flow shortfall, said she was "delighted" with the board's action.

Comptroller Joan M. Pratt cast the only vote against the deal, saying the city should not have turned down a $42 million state loan, which the General Assembly was on the verge of considering last week when the city bailout suddenly emerged as an alternative.

Some city leaders opposed the state deal because it would have given Annapolisthe power to tear up the teachers' contract -- and afforded O'Malley's political nemesis, Gov. Robert L. Ehrlich Jr., a chance to come to the rescue.

Pratt said it made little sense to reject state help on the premise of protecting teachers, since the schools will likely seek layoffs or salary concessions to get its finances under control. She said the deal would hurt the city's bond rating, which the ratings firm Fitch said it expected to lower from A-plus when the plan was announced.

"In my expert opinion as a certified public accountant, making this loan is not a financially wise decision," she said.

Pratt also said the state loan would have been a better deal for the schools, since it would have provided more money for a longer period than the city bailout. The state plan would have provided $58 million: $42 million from the state, $8 million from the city and $8 million from Baltimore's nonprofit Abell Foundation. The city plan provides $50 million: $42 million from the city and $8 million from the foundation. The schools will have to repay $34 million of the city loan by August and the remaining $8 million in June 2006. The foundation's loan is to be repaid next fiscal year. The state would have lent its $42 million until 2006.

Ehrlich said yesterday that he would be willing to help if the city plan fails, but he suggested that Baltimore had burned a bridge with members of the General Assembly.

"If it's more money after bad, lacking any functionality, lacking any accountability ... forget the administration. You have an impossible sell with your colleagues downstairs," Ehrlich said he told city lawmakers.

O'Malley contends that his plan will provide that accountability and restore some of the mayoral sway lost in the creation of a city-state schools partnership formed in 1997 to oversee Baltimore schools.

The recovery plan will allow O'Malley to send representatives to weekly SchoolStat meetings, where the system's performance is reviewed. Monthly reports must be submitted to the city's finance director, Peggy Watson, and quarterly meetings will take place between Watson and school officials.

The city loan was finalized after some last-minute maneuvering. Council President Sheila Dixon wanted the council to have an appointee to a fiscal operating committee that is to be created under the plan. The board agreed to give the council a nonvoting appointee.

State Superintendent of Schools Nancy S. Grasmick or her designee may serve as a nonvoting member of the committee, whose three voting members will be appointed by O'Malley. The panel will make recommendations to the school board, which will have final say.

Pratt asked for her own appointee to the committee, but O'Malley and Solicitor Thurman W. Zollicoffer Jr. said that as comptroller, she needed to keep an arms-length distance from the schools if she wanted to audit them. Pratt then asked that the agreement be amended to state that she has the right to audit the schools. Zollicoffer said that was already her right as comptroller, but the board agreed to add the statement.

Sun staff writer Howard Libit contributed to this article.