The release of hundreds of emails about the Potomac Yard Metro station has sparked a battle between Alexandria residents who say city officials lied to them and a municipal government caught between a promise of confidentiality and demands for transparency.

The emails, made public this week in response to a ­public-records request by neighborhood residents, show that Alexandria officials knew early last summer that the planned station could lose its south entrance, closest to hundreds of existing residences. The public learned of the change last month. That delay, as well as the loss of the entrance, has enraged residents, many of whom were counting on easy access to the transit station.

“It was such a shock to us, almost like getting punched in the gut,” said Potomac Yard resident Adrien Kay Lopez, who filed the Freedom of Information Act request. “We were so disappointed and angry that our city officials at all levels had lied to us.”

City Manager Mark Jinks on Tuesday sent an explanatory message to the website “Concerned Residents of Potomac Yard,” which posted the emails. Jinks wrote that city employees and elected officials believed that they were prohibited from talking about the elimination of the entrance by a confidentiality pledge required by the Metro board during the procurement process.

The dispute could not come at a worse time for Alexandria’s elected mayor and City Council, most of whom are running for reelection in Tuesday’s Democratic primary. At a candidate forum Tuesday night, the moderator did not ask questions about the dispute. But tweets from the public, projected behind the candidates, did. Several nonincumbent candidates talked about improving local transparency and restoring trust in government.

The Potomac Yard station has been discussed for more than two decades and is considered key to Alexandria’s economic future. The former railroad yard, home to a shopping center, condos, apartments and acres of empty land, is in the running for Amazon’s second headquarters.

Even without that massive project, the city says the station is expected to generate billions in new development in coming years, supporting 26,000 new jobs and 13,000 new residents.

The Metro stop was slated to have one entrance near the planned commercial hub on the north end, and another about a third of a mile to the south at East Glebe Road.

But rising construction costs in the first half of 2017 prompted the city and the Metro board to look for ways to save money, including eliminating the southern entrance.

Deputy City Manager Emily Baker twice told The Washington Post that Mayor Allison Silberberg (D) and the rest of the council were told about the likely loss of the southern entrance before July 2017.

Silberberg said the council was not told the entrance would be removed during that briefing, but her challenger, Vice Mayor Justin Wilson (D) said in a separate interview that it was clear that the entrance was at risk.

City officials also say they believed they could not discuss anything about the Metro stop with the public while the Metro-run procurement process was underway.

Metro officials deny that they ever barred Alexandria from talking about the south entrance, but Jinks said they were clearly and repeatedly told to reveal nothing or risk another major construction delay.

The elimination of the entrance was accidentally made public in April, after the Metro board published a committee agenda that included a rendering of the station without the entrance.

When residents asked questions, city officials described the drawing as an error and “premature.”

“This is going to be a mess,” Wilson wrote to Jinks, according to the newly released documents. “Hearing from folks from every different perspective.”

In an email to Jason Kacamburas, Alexandria’s Potomac Yard project coordinator, Metro chief engineer John D. Thomas said the design change “is not proprietary from a procurement standpoint.”

Residents point to that email as the “smoking gun” proving that confidentiality was not necessary. City officials say the note startled them into calling for a meeting with higher-level Metro board officials to clarify what they could and could not tell the public.

At the same time, council member Paul Smedberg (D), the city’s appointee to the Metro board, began hearing from people who thought there would be no access to the Metro station from the west side of the tracks. He directed his aide to respond to emailed inquiries by saying there would be access.

“The drawings to which you allude are not correct nor are they final,” the aide wrote on behalf of Smedberg, according to the newly released documents.

“I was trying to be upfront and direct with everyone that asked, but the process unfortunately did tie our hands to a degree,” Smedberg said in an interview. “No one that I know of — and not I — certainly didn’t purposely lie to anyone.”

After meeting with Metro’s top officials May 1, city manager Jinks said the city was authorized to announce the stripped-down station design. That’s when citizen outrage blossomed.

Silberberg says she is fully committed to adding the south entrance after the Metro station is built.

The residents have appealed the Alexandria city attorney’s decision to withhold 704 additional records, on the basis that they contain privileged legal advice, notes from closed meetings and information about the contracting process for building the new station.