Soviet leader Mikhail Gorbachev saw a well-behaved and decorous Washington during his three days in the nation's capital, despite the potential for complications from furious demonstrators and eager onlookers who crowded street corners to catch a glimpse of the visitors.

As officials reviewed the city's performance yesterday, they tallied only 37 arrests -- including 15 that involved prearranged arrests for civil disobedience -- and concluded that everyone from law enforcement officers to gawking citizens acquitted themselves well.

"We think under the circumstances, we performed one hell of a job," said D.C. Police Chief Maurice T. Turner Jr. "There was a language barrier, a cultural barrier. The officers worked very hard with the KGB at protecting the general secretary."

In many ways, their job was made easier by the sense of calm and politeness displayed by the populace.

Even at Gorbachev's most public appearance, at Connecticut Avenue and L Street NW on Thursday, the crowd seemed to know its place.

When his motorcade jerked to a halt and security agents jumped out, onlookers said they thought at first that something was amiss. But even after the crowd realized that this was a glad-handing stop by Gorbachev, people approached him only from the front. No one crossed either street to approach him from behind, a more vulnerable spot where fewer security agents were posted.

"It was like there was a magical line, and they didn't cross it," said a source familiar with the summit preparations. "That was amazing to me."

On Wednesday, as hundreds of people gathered at 16th and L streets for a view of Gorbachev's embassy after the signing of the arms control treaty, a man and woman began a rhythmic chanting of "peace now" in an effort to whip the crowd into an instant protest. Nervous police officers, anticipating trouble, sidled over to them.

But the crowd wasn't responding, and the couple was chanting alone. Finally, an elderly man told them off, citing the city law for demonstrating near an embassy.

"Why don't you go down the block so you're 500 feet away from the embassy?" the man said. "We don't want this city to have a black eye."

The assembled group burst into applause as the defeated couple departed.

Even the thousands of demonstrators who swarmed into Lafayette Park and other official sites won praise from law enforcement officials, pleased and somewhat surprised that the protests had been so peaceful.

"This is much better than we expected," said U.S. Park Police Maj. Carl Holmberg, who was in charge of the forces who handled the demonstration sites. "We expected to be inundated by numbers and by emotional demonstrators, but for the most part, people were quite well-behaved."

The only unpleasant incident at any of the numerous rallies came Tuesday, when two competing factions of anti-Soviet Afghans started arguing on the White House sidewalk, ending with a scuffle and 17 arrests for a range of minor offenses.

Fifteen Jewish demonstrators were arrested the same day in a planned show of civil disobedience when they sat down on 16th Street closer to the Soviet Embassy than D.C. law allows for protesters.

Five others were arrested in separate incidents, including one in which a Virginia man was arrested near the Soviet Embassy for trying to throw a football at Gorbachev's limousine.

Dan New, security chief at an office building in the middle of the action at 16th and L, was beaming yesterday after six exhausting days helping police and Secret Service cope with the sometimes crushing crowds.

"I'm so proud of the police and the cooperation of the general public," said New, who for years has greeted by name the hundreds of office workers and Soviet diplomats on the block. "Everybody was joking with everybody. The workers were bringing coffee and doughnuts to the police officers on the line. This was a bringing together, black, white, everybody."

The visit, by all accounts, went smoothly, but law enforcement officials were glad when it ended. "There was great relief . . . when the plane lifted off the ground," Turner said.

Turner said that overtime -- at an average of about $23 an hour per officer -- and other costs were being computed. Other officials said the final tally is sure to be large.

Turner said the police operation for Gorbachev's visit was far more extensive than for the 1979 visit of Pope John Paul II, which lasted only 34 hours. The police overtime bill then was about $800,000.

"It was the most complex security package I've seen since I've been in the department," said Turner, a 30-year veteran of the force. He also said he is confident the State Department will reimburse the city.

For its part, though, the State Department was mum on the cost to taxpayers. A department spokesman told reporters yesterday that "it is not our usual practice to talk about costs, whether it's receiving the Queen of England or the General Secretary."

Yesterday many people around town still were comparing notes on Gorbachev's Connecticut Avenue stop, with some speculation that the stop -- right in front of the office building that houses the Secret Service headquarters and within blocks of most major media outlets -- might have been planned. But a knowledgeable source said U.S. officials were taken completely by surprise.

One source familiar with the summit preparations praised the city's patience in handling the inconveniences. "Washington was a different city for the past five days," he said, adding that from the very first motorcade bringing Gorbachev from Andrews Air Force Base, "I knew we were golden."

Staff writer Victoria Churchville contributed to this report.