Montgomery and Prince George's county officials signed a long-sought plan for funding the fire services of Takoma Park yesterday, removing one of that city's last major complaints about its divided status.

For years, funding for the firehouse has been a major source of irritation for the two county governments and the city, of which two-thirds lies in Montgomery and one-third in Prince George's.

The firehouse is on the Montgomery County side and that county has paid for its operation since 1974. But its firefighters respond to calls from Prince George's residents as well -- which has fueled demands by Montgomery County for compensation that, when rejected, sparked threats to close the station.

The dispute also has contributed to a spirited movement, led in part by the city's former mayor Sammie Abbott, to redraw city boundaries to unify the city in one county, preferably Montgomery, a move Prince George's officials have repeatedly quashed at the cost of much ill feeling in the politically active community.

Under the complicated agreement signed yesterday, Prince George's will give Takoma Park an annual grant set at $355,000 next year to help fund fire services to city residents. In turn Takoma Park will reimburse Montgomery County for a portion of the cost of operating the station, a figure set at $495,000 for the upcoming fiscal year.

Takoma Park residents will be taxed for the cost of fire services at the rate of about 27 cents per $100 of assessed property value. Residents on the Prince George's side also will lose a portion of a tax rebate that municipal residents receive on county taxes.

But those same Prince George's residents, who currently pay a higher city tax rate, will pay less of that tax than before.

Although one City Council member voted against the agreement -- calling it unfair to Prince George's taxpayers -- the council voted 5 to 1 in support and both Prince George's Executive Parris Glendening and Montgomery Executive Charles W. Gilchrist enthusiastically signed the measure yesterday.

The fire agreement, together with a new state law giving the city a greater voice in establishing and enforcing zoning codes, addresses key complaints of proponents of unification.

Nevertheless, said Mayor Steven J. Del Giudice, "I think the city is still hopeful that someday we will have our city unified into one county."

Other officials at the signing ceremony hailed the agreement as part of a new spirit of cooperation. "In the past, whenever I saw 'Takoma Park' on an agenda I knew I was going to leave the meeting with a headache," said Montgomery County Council member Esther Gelman. "I don't feel that way anymore. There's a new attitude, a new spirit here that you can just feel."