When the Union Temple Baptist Church, a thriving Anacostia congregation, proposed several months ago to replace its old former Masonic temple building with a contemporary-style stone and glass structure, its leaders got a jolting surprise.

A District of Columbia law, they learned, would not allow the church to be torn down because it was located inside the boundaries of the Anacostia Historic District, something the church leaders said they had never heard of. So they sent their architectural designer back to the drawing board and ended up with a plan that will protect and expand the old red brick structure.

The kind of official review that Union Temple Church experienced has become commonplace in the District of Columbia as the result of the City Council's enactment in 1978 of the Historic Landmark and Historic District Preservation Act. That law is "one of the strongest in the nation," according to Frank Gilbert, assistant general counsel of the Washington-based National Trust for Historic Preservation.

Under its provisions, restrictions against demolitions or architecturally jarring renovations have been placed on an estimated 14,000 structures in 14 officially declared historic districts throughout the city. The newest of the districts, comprising both sides of the 15th Street financial district in downtown Washington from Pennsylvania Avenue to I Street, officially was created just last week.

Once a historic district is created, the law affects every building within its boundaries, ranging from -- for example -- St. Matthew's Catholic Cathedral to derelict sheds. It covers the right to replace fences and awnings and even to clean exteriors by sandblasting.

The rules affecting the historic districts are in addition to, and sometimes geographically overlap, the listing as historic landmarks of about 375 individual buildings and sites in the city, ranging from the Capitol and the White House to Mary Surratt's boardinghouse in present-day Chinatown where the 1865 assassination of President Lincoln was said to have been plotted.

One effect of the law, the one desired by its sponsors, has been the preservation of some of old Washington's dwindling architectural heritage, most recently Red Lion Row -- a group of sagging 19th century town houses that will be restored to form the threshhold of a new building project on the Pennsylvania Avenue edge of the George Washington University campus.

The law has assured that the Mayflower Hotel, site of President Coolidge's inaugural ball when it was the city's newest hostelry, will look the same after its current remodeling as it did before. Even the window frames must look like the original wood, even if modern weather-resistant materials are used.

And the law even has led to changes in plans for new buildings within the historic areas to mesh them with their surroundings. An office building at 1724 Massachusetts Ave. NW, near Dupont Circle, was designed to the same scale and texture as adjacent former mansions without attempting to mimic the old architectural styles themselves. Its design was the first for a new building reviewed under the 1978 legislation

There is no way to reckon how many buildings have been saved from demolition by the law, according to one city employe who helps administer it. Countless people -- like the leaders of the Anacostia church -- who planned to tear down their structures could not routinely obtain demolition permits and applied instead for renovations, she said.

The bill that evolved into the landmarks law was introduced in the council by John A. Wilson (D-Ward 2) on June 28, 1978, with support from preservationist groups, including Don't Tear It Down, a citizen organization. The introduction came just two days after the U.S. Supreme Court handed down its -- literally -- landmark ruling that New York's Grand Central Terminal could not be demolished simply because the land could be put to more profitable use.

The new D.C. law added teeth to previous city regulations by prohibiting, except for only two reasons, the razing of privately owned individual landmark buildings. Until then, such demolitions could be delayed while alternative plans were being explored, but could not be banned outright.

Perhaps more significant to large numbers of local property owners, the law provided new rules for creating historic districts, a task delegated to a nine-member panel called the Joint Committee on Landmarks of the National Capital. It is jointly sponsored by the D.C. government and the two federal boards directly concerned with the city's development, the National Capital Planning Commission and the Fine Arts Commission.

"Historic" does not necessarily mean that something historic occurred in the district. It may reflect the fact that a neighborhood's buildings reflect, for example, the architectural style of a particular time period.

Plans are afoot also to declare the entire old downtown commercial area along Seventh and F streets and most of Chinatown as historic districts, the latter because it contains a concentration of residential structures built before the Civil War. Hearings will be held next month.

Once a historic district is created, the same joint committee -- or in routine instances, its staff -- is required to review all plans for demolitions, alterations or construction within its boundary. If found incompatible with the ambiance of the historic district, the plans may be rejected. Rejections may be appealed, but only on narrow grounds, to a representative of the mayor.

Louis P. Robbins, an attorney who represents some commercial developers, has, described the law as "historic preservation with a vengeance" because, he said, it not only protects truly historic buildings but also threatens to block new development throughout entire neighborhoods..

However, Lucy Franklin, chief of historic preservation for the D.C. Department of Housing and Community Development, who functions as a top staff member of the joint committee, said about 500 permit applications were filed in the 12-month period that ended last Sept. 30, and more than 85 percent were granted after staff review within two or three days. Others are reviewed by the full committee or a panel of some of its members.

"One sign that the law is working well is that we are getting better designs on alterations and new buildings," she said. "If there is a balance between new development and preservation, I guess we've found it."

Gilbert, the official of the National Trust for Historic Preservation, said landmarks laws around the country are having the same effect. "They have been a tremendously effective force toward saving and rehabilitating neighborhoods," he said. "The law here . . . makes it easier to preserve buildings, easier to come up with some alternatives to demolition."

In the case of the Union Temple Church in Anacostia, "four or five" original and revised plans for the building at 2002 14th St. SE were submitted to the committee or its staff, according to designer William Ozier. The first proposal was officially rebuffed by the joint committee because, in its words, "the proposal would necessitate the virtual demolition of the existing church structure, a late 19th century Masonic hall that anchors an important site" at an end of Anacostia's old Market Square.

With the final redesign, approved subject to the submission of revised drawings, a new wing will be added following the original architectural style, and the entrance will beshifted from the present front to the side of the building. The interior will be as modern as the exterior is old-fashioned, designer Ozier said.

The Rev. Willie F. Wilson, pastor of the church, called the process "a very hectic ordeal," and said he still prefers the original design. "But we understand the need to preserve a significant historic area," he said..

The law so far has failed to save one structure with unquestioned historic ties to Washington's beginnings, the forlorn Rhodes Tavern at 15th and F streets NW. A representative of Mayor Marion Barry has ruled under a provision of the landmarks law that a commmercial development planned by the Oliver T. Carr Co. on the site is of such "special merit" that it overrides the legislation's preservationist aims. That decision has been appealed in court.