ALBANY — Mayor Bill de Blasio arrived here on Tuesday with a substantial wish list for the State Legislature, urging lawmakers to deliver money for several of New York City’s needs, including public housing, infrastructure and health care.

Many of his listeners, however, were less than sympathetic.

Mayoral pitch turned to mayoral defense as Mr. de Blasio, a Democrat, repeatedly found himself justifying the city’s tax and spending practices. Testimony expected to last no more than a few hours became a five-hour slog, as he explained the need for the city to maintain a surplus, and calmly opposed arguments that the city should contribute hundreds of millions of dollars more to help pay for Medicaid and the City University of New York system.

“The bottom line is that the city is awash in money right now,” said Senator Catharine Young, a Cattaraugus County Republican and chairwoman of the Finance Committee, who opened the question-and-answer period of Mr. de Blasio’s testimony with a skeptical assessment of his message: “Basically, what you’re saying is that you’re demanding more money from the state’s taxpayers.”

It was a familiar dynamic for Mr. de Blasio, who now has two years of experience with the delicate fiscal dance that has left the city disappointed more often than not. As the mayor and legislators made their opening offers in what will become a monthslong negotiation, the city contingent offered a gentle reminder that the city is home to nearly half the state’s population and accounts for 57 percent of its revenue.

Yet the city must depend on Albany’s good will not only for money, but also for legislation that affects rent controls, public schools and other parts of Mr. de Blasio’s agenda, and he was careful not to complain of his grilling.

“I thought it was a very productive hearing — long, yes, but very productive,” he said after emerging from the office of John J. Flanagan, the majority leader of the Republican-controlled State Senate, and before going to a meeting with Gov. Andrew M. Cuomo and another with the State Assembly speaker, Carl E. Heastie.

“The hearing indicated some of the realities we live with in our state; there are partisan differences, there are regional differences. I still think it was respectful, I think it was a pretty informed and fair hearing.”

The city is starting budget negotiations at a disadvantage: The budget that Mr. Cuomo, a Democrat, proposed this month would shift hundreds of millions in formerly state-covered costs to the city, while taking back $600 million in city sales-tax revenue.

Soon after unveiling these moves, Mr. Cuomo explained that he wanted the city and state to work together so the proposals would not “cost New York City a penny,” a promise Mr. de Blasio quoted several times during the hearing. But Republican lawmakers made it clear they would be content to let the city bear the extra expense, recycling some of the governor’s own arguments in favor of his proposals and further insisting the city enjoys resources far beyond those of struggling upstate communities.

Even as Mr. de Blasio resisted these cuts and others, he had to beat back questions that took city officials and onlookers alike by surprise. At least eight different lawmakers pressed him to explain why the city does not abide by a cap on property taxes that applies to other municipalities. Republicans have previously proposed forcing the city to impose the cap, but the issue also gained traction during the hearing with several city Democrats who want tax breaks for homeowners they represent.

As the mayor spoke, the Senate was passing a bill to impose the cap on the city, a move the Republican majority said would save city taxpayers $4.5 billion by 2019. The Democratic majority in the Assembly dismissed any possibility that it would follow suit.

“I believe that New York City, although larger, although having a unique set of circumstances, if we’re one state, then we’re one state, and we should be under the same guidelines to save our taxpayers dollars,” said Senator Kathleen A. Marchione, a Republican from Saratoga County.

The tax cap, passed in 2011, prevents local governments from increasing property tax rates by more than 2 percent each year.

Tax-cap question after tax-cap question, Mr. de Blasio responded the same way. He said the city’s financial situation was different from other municipalities’, as it funds services that others do not. He suggested that the city, as the prime driver of the state’s economy, needed resources to continue growing. And he warned of future fiscal tempests, saying the city should save its surplus — currently under threat from the governor’s proposals — for an especially rainy day.

“We will continue to build the New York City economy for the good of the whole state, with many benefits for the entire metropolitan area and the entire state,” the mayor said. “That’s my argument about why I think we should avoid a strategy that could limit that growth and our ability to handle the downturns when they do come.”

Mr. de Blasio also noted that the city is the only municipality in the state that receives no direct, unrestricted aid from Albany. The mayor’s aides later dismissed the property tax issue as a distraction, pointing out that the effective property tax rate on city homeowners was less than a third of the rate in the counties surrounding the city, and fiscal analysts, as well as other Democrats, chimed in with their own criticisms.

Much less time was devoted to the other elements of the mayor’s Albany agenda, including education, housing and homelessness.

Mr. de Blasio objected to a proposal by Mr. Cuomo to increase funding for charter schools while shifting the responsibility from the state to the city. If the state wanted to increase funding for charter schools, the mayor said, it should provide the city with additional resources.

His remarks drew condemnation from several charter school groups, which have strong supporters in the Senate.

He also had to plead for the Legislature to knock down Mr. Cuomo’s proposal to take the city’s sales tax revenue for three years in exchange for savings the city received on refinanced debt that the state pays for.

Mr. de Blasio asked the state to send the rest of the $100 million in capital funding for the New York City Housing Authority that it had promised — but not fully delivered — this year, as well as to commit another $100 million for each of the next two years. He also requested that the state devote more funding to homelessness prevention programs.

The Legislature snubbed Mr. de Blasio last year by granting him only a one-year renewal of his control over the public schools. He said on Tuesday that he would ask for permanent mayoral control, but that he would settle for seven years. The Legislature has until the end of its session to vote on that measure.

Jesse McKinley contributed reporting from Albany, and Kate Taylor from New York.

Jesse McKinley contributed reporting from Albany, and Kate Taylor from New York.

A version of this article appears in print on , on Page A23 of the New York edition with the headline: De Blasio Spars for Hours With Legislators as He Makes City’s Fiscal Case. Order Reprints | Today’s Paper | Subscribe