Days before 60,000 fans crowded City Hall Plaza for the Boston Calling music festival over Memorial Day weekend — and unbeknownst to Walsh administration brass — a top city manager hired a contractor to secretly fix a huge defect in the plaza that engineers had warned could collapse at any moment, a dangerous flaw City Hall first learned about two years ago.

Michael Galvin, head of the city’s Property Management Division, said he kept the work under wraps by putting up a tent to hide the emergency repairs on the 30-foot-by-30-foot danger zone, where the remnants of a defunct fountain, now eight feet under the plaza, were capped in 2006.

“No one was the wiser because that was the way I designed it. I put a tent over it,” Galvin said of the hatch that let workers enter the area beneath the 4-inch-thick concrete cap covering the old fountain. “I wanted it started on Saturday (May 17) because the (Boston Calling organizers) were not coming in until Monday morning.”

Galvin’s crew had cordoned off the zone with an array of bike racks after it was deemed structurally unsafe in 2012 by engineers from Weidlinger Associates. The same firm filed an alarming report last month — just a week before the first act was to take the stage for the sold-out Boston Calling festival.

“The area shall not be loaded with vehicles or pedestrians until the area can be shored. The allowable load capacity is ZERO,” the engineers wrote in their May 16 report, noting that the capping of the fountain pool had been done “in conflict with construction documents” and that stud walls over the fountain pool were “essentially unsupported.”

Galvin, who said he never informed Mayor Martin J. Walsh, acknowledged that organizers of the music festival had threatened to pull out if the bike racks weren’t removed to make room for one of the festival’s two stages.

“That’s what had me spring into action,” Galvin told the Herald. “You had 20,000 people on that plaza area jumping up and down.”

Galvin said he met on May 15 with Classic Construction, one of the so-called “house doctors” — contractors on speed dial to do emergency or small repair jobs for the city — and the company verbally agreed to do the work for $20,000.

No written contract or request for proposal was issued, and Galvin said he has not received a bill from the contractor, although he expects the costs to exceed $20,000 because the scope of the work increased.

Walsh said he did not learn of the repair work until a Herald reporter began asking about it yesterday.

“I’m not happy about this,” Walsh said, adding that written bids should have been sought for the project. “Michael Galvin does great work for the city of Boston but I was shocked to find this out. … I am going to correct this. … We certainly acted too slowly on this. Waiting until the last minute (to make repairs) is not acceptable. I am going to make sure something like this does not happen again.”

Matthew Cahill of the Boston Finance Commission, a city watchdog agency, said the city should have made the repairs years ago. “There should never have been an emergency contract,” he said.

City Hall Plaza has long hosted many large annual events, including a seven-week run of the Big Apple Circus and a three-day Phantom Gourmet BBQ Beach Party, which imports 10 tons of sand to create a fake beach where the repairs were done.

The dormant fountain, which had become an eyesore and a hangout for drug addicts, was capped in 2006 by an MBTA contractor at a cost of $934,000.

Galvin, who said the capping had a five-year life expectancy, insisted it was all perfectly safe, noting that Big Apple Circus parked trailers with portable bathrooms and stables for animals there recently and forklifts drive over it.

“You had a lot of weight on it,” he said. “That area is safe. … I really feel it would not have collapsed.”