Objections were voiced by many in New York’s arts community, but for a different reason: in a potential conflict of interest, the exhibition drew from the collection of a single wealthy collector, Charles Saatchi, who had helped finance the show.

City Hall’s rawest fury, however, was reserved for the “Holy Virgin Mary,” by the artist Chris Ofili. Mr. Lhota, who had briefly considered becoming a priest, concedes that he did not see the artwork — or the rest of the “Sensation” exhibition — in person, despite living in Brooklyn Heights, about 10 minutes from the museum. He looked at pictures instead.

“The use of the dung, I thought, was gratuitous,” he said.

As Mr. Giuliani denounced the show before it opened as “sick stuff” and “Catholic-bashing,” a sentiment shared by many, Mr. Lhota quickly became the administration’s hands-on enforcer in the case, interviews and court records show. His blunt message to the museum’s chairman: Unless the “Holy Virgin Mary” was removed from the show, the city would cut off the museum’s financing, its $7 million-a-year lifeblood.

When the museum balked, Mr. Lhota searched for ways to prevent it from using taxpayer money for the exhibition. He scoured the museum’s century-old lease with the city, discovering what he believed was a violation of its agreement to use a city-owned building: “Sensation” planned to charge attendees $9.75 and restrict entry for children under 17, despite lease rules that required free admission for all.

“I advised the mayor at the time,” Mr. Lhota later testified, that “I thought there was a problem here.”

Soon after, he took the unusual step of attending an emergency meeting of the museum’s directors, warning them that it would be illegal to proceed with the exhibition, testimony shows.

When the directors voted to proceed with the show, Mr. Lhota, as the mayor’s representative on the board, cast the sole dissenting ballot. Outside of the museum’s lobby, he announced the city’s punishment: withholding the museum’s first payment of the year, a check for $500,000.