Walmart Stores Inc. said it is abandoning efforts to build a grocery market in Somerville and a big-box store in Watertown, saying the projects no longer make financial sense for the world’s largest retailer.

“One of the primary deciding factors on any given site – whether it’s in an urban, suburban or rural market – is that it makes sense from a business perspective and contributes to our bottom line,” said Walmart spokesman Steven Restivo. “In the case of the Somerville and Watertown sites, we made a business decision that the projected cost of investment would ultimately exceed our expected return.”

The Arkansas chain had not yet submitted formal plans for either store to the two towns, but its proposals had split members of those communities. In Somerville, Walmart wanted to open a Neighborhood Market, a small grocery on the site of a former Circuit City store on Mystic Avenue at the edge of Assembly Square shopping district. In Watertown, the retailer was looking to construct a 90,000 square-foot Supercenter on Arsenal Street.

Advertisement - Continue Reading Below

Somerville mayor Joseph A. Curatone said he was disappointed Walmart will not build the grocery after all, adding that he and other city officials “were highly sold” on the type of store the retailer had proposed-- a smaller “urban style” market with fresh produce.

“They’re the number one retailer in the world and we’re flattered that they thought about investing in Somerville,” Curatone said. But “their interest in this particular site has ended. They are no longer interested in this building.”

In Watertown, about 50 protesters gathered at a rally last month to oppose the proposed Walmart. Residents cited concerns about increased traffic, noise, and threats to small business owners.

Watertown council president Mark S. Sideris said he believes residents’ strong negative reaction to a Walmart store in their town influenced the retailer’s decision to put aside its plans.

“There are a number of “No Walmart, No Big Boxes” signs on people’s lawns at this point,” Sideris said. “The movement was growing.”

But Restivo, the Walmart spokesman, said the anti-Walmart battles were not the reason why the company pulled out, pointing out the company overcame similar opposition to new stores in Lynn and Salem.

“The campaigns in those two communities weren’t unlike those campaigns in Lynn or Salem,” said Restivo. Walmart ultimately opened stores in both of those locations. Today the company has 47 Supercenters and discount stores in Massachusetts as well as two Sam’s Clubs. Walmart also has a Supercenter under construction in Raynham and will break ground on a Supercenter in Saugus in the fall.

Despite the opposition, Walmart continues to pursue sites in greater Boston, Restivo said, including a Neighborhood Market store, the company’s line of mid-sized, low-cost grocery stores aimed in urban markets.

Last year Boston officials declined to endorse a plan to build a Neighborhood Market at the former Bartlett bus yard, a shuttered MBTA maintenance facility near Dudley Square, where food-shopping options are few. City officials were concerned that the Walmart grocery would undercut local businesses.