Updated

Financial services giant UBS will receive $20 million in state loans over five years in exchange for a commitment by the company to keep a minimum of 2,000 jobs at its Connecticut headquarters, which includes the world's largest trading floor, Gov. Dannel P. Malloy said Tuesday.

The announcement ends nearly a year of speculation and rumors from Stamford to Hartford among businesses, politicians and economic development officials that UBS would leave Stamford and return to New York City. In the agreement, UBS will make "minor staff relocations between Stamford and New York," the governor's office said in a statement.

Philip J. Lofts, chief executive of UBS Group Americas, appeared at the news conference with Malloy, the former mayor of Stamford, and cited the state's recognition of UBS' importance in downtown Stamford and benefits of remaining in southwest Connecticut, including a talented workforce, for staying in Connecticut.

The company will spend the money on unspecified improvements in infrastructure, employee training and technology. Swiss bank UBS AG announced Tuesday that it would cut 3,500 jobs worldwide as part of an effort to save $2.5 billion annually by the end of 2013.

UBS hasn't said how many employees work at the Stamford site, which it has occupied for nearly 10 years and includes a 93,000-square-foot trading floor. Lofts also wouldn't disclose how many local jobs may be eliminated.

"We want to stay here in Stamford for the foreseeable future," he said.

When asked about the $20 million state assistance at a time when he and the legislature have cut programs and raised taxes to close a budget deficit, Malloy said the state could have lost as much as $70 million in tax revenue annually if UBS left Connecticut. In addition, he said the financial services industry has had "some real problems" during the recession and weak economic recovery that has followed.

"I thought we were going to lose everything," the Democratic governor told reporters after the announcement. "At times I was truly nervous about what I was hearing."

Malloy also said UBS would be eligible for $7 million more in forgivable loans if the company adds more jobs in the future.

Jack Condlin, president and CEO of the Stamford Chamber of Commerce, said in an interview Tuesday that talk of UBS moving at least some of its business from Stamford began about a year ago when the city's business community "heard rumblings about it." Real estate brokers were particularly alarmed, he said.

Stamford, a city of 117,000 residents, made a strong play during the 1980s and '90s for financial services companies that do business in New York, just 25 miles southwest. A move by UBS out of the city would have been a major blow to Malloy, who was mayor from 1995 to 2009 and took credit during his gubernatorial campaign last year for playing a large role in transforming the city from a declining mill town into a financial center.

Unemployment in the Bridgeport-Stamford labor market was 8.5 percent in July, lower than the statewide rate of 9.2 percent.

Condlin said commercial real estate has a vacancy rate that is "still too high" and home prices have plummeted by 10 to 15 percent, he said.

"Stamford has always had a stronger economy," he said. "We've always had job growth. Now, it's job loss but less than the rest of the state."

Just a few blocks from UBS' glass-sheathed office tower, a block of shuttered storefront businesses offers evidence that the Great Recession, over for more than two years, has never ended for some.

Mohammed Uddin, owner of the Downtown Mini Mart, said keeping jobs at UBS will make only a "little difference" for small businesses that are reeling from the weak economy.

"Every day is worse, worse, worse," he said. "Everyone is closing."