WASHINGTON — Mayor Vincent C. Gray vetoed legislation on Thursday that would have forced large retailers in the District of Columbia to significantly increase the minimum wage rate in the nation’s capital, handing a victory to Wal-Mart Stores Inc., which had threatened to pull out of three planned stores if the bill became law.

Gray, citing the risk that the city would potentially lose 4,000 jobs, had been under intense pressure from Wal-Mart to veto the legislation, known as the Large Retailer Accountability Act of 2013.

“I am vetoing this legislation precisely because I believe in providing a living wage to as many District residents as possible, and this bill is not a true living-wage measure,” said Gray, noting that it would raise the minimum wage for only a small portion of the District’s workforce. “While the intentions of its supporters were good, this bill is simply a woefully inadequate and flawed vehicle for achieving the goal we all share.”

The bill, passed by the City Council in July by a vote of eight to five, would require large retailers that operate a store in D.C. with a minimum of 75,000 square feet and have a parent company with at least $1 billion in annual revenue to pay employees earning less than $50,000 a year a “living wage,” which it established at $12.50 an hour, well above the current hourly minimum wage in D.C. of $8.25.

The measure provided a four-year grace period for large retailers with existing stores in D.C., and exempted unionized stores and franchises from the living wage requirements. It also indexed the rate to inflation based on the Consumer Price Index.

The City Council can override Gray’s veto, but needs nine votes to do so. City Council Chairman Phil Mendelson said he has scheduled an override vote for Sept. 17.

“Much of this legislation was targeted at Wal-Mart,” said a spokesman for Gray. “Other large retailers considering moving to or expanding in the District told us if the bill became law, they would change their plans or seriously reconsider coming to or expanding in the District, including retailers that are already here, such as Macy’s and Target.”

A Wal-Mart spokesman said, “Mayor Gray has chosen jobs, economic development and common sense over special interests, and that’s good news for D.C. residents. Now that this discriminatory legislation is behind us, we will move forward on our first stores in the nation’s capital. We look forward to finishing the work we started in the city almost three years ago — a plan to bring more jobs, shopping options and fresh food choices to Washington, D.C., residents.”