Just when things had started looking up for Barclays, along came Standard & Poor's and cut the bank's credit rating.S&P said the move, announced late on July 2nd, reflected the size of Barclays' investment banking arm and the increased risks faced by that business.The main threats, S&P said, are tighter regulation, fragile markets and weak European economies.S&P said Barclays was exposed to the US Federal Reserve's proposals for foreign banks and that regulatory risk was particularly pertinent because the UK has taken a particularly tough line on reform.The bank's shares suffered the next day, falling 1.4% to 281p. But they have since recovered, and were trading at 293p at 10:12 UK time on Friday.Gary Greenwood, Shore Capital banking analyst, said: "Rating agencies tend to be a bit backward in their assessments. Equity markets are well aware of the issues they have been flagging and have been for some time. There's always an issue in ratings downgrades in terms of the amount of collateral that counterparties demand but I don't expect it will have a massive impact on operating performance or funding costs."One of the regulatory headaches is a requirement for banks to have capital worth at least 3.0% of their assets. A recent "stress test" of UK banks' found Barclays was half a percentage point short of achieving this leverage ratio. The timing of the ratio is the problem after the Bank of England's Prudential Regulatory Authority (PRA) caught the bank and Nationwide Building Society by surprise by demanding plans last month.S&P analyst Richard Barnes said on a call to discuss the downgrades: "It [the leverage ratio] is something they need to take action on sooner rather than later."Chief Executive Antony Jenkins said on June 28th that the measure could force Barclays to cut back its lending, incensing the PRA.Jenkins' appointment was meant to repair the fractious relationship between Barclays and its regulators under former bosses Bob Diamond and John Varley. Instead the former retail banker has found himself in another scrap with the City watchdog.S&P's view casts doubt on the wisdom of Barclays' takeover of Lehman Brothers at the height of the crisis. The distressed sale at a knock-down price put Barclays into the "bulge bracket" of US investment banks.But it also made Barclays even more dependent on investment banking after Diamond had built the business into the major source of the bank's growth.However, Ian Gordon, a banking analyst at Investec, said S&P failed to take into account Barclays' ability to gain more business as rivals are forced to retrench."There are a number of regulatory headwinds but they are mitigated by ongoing consolidated market share." Barclays also has scope to cut costs at its investment bank to offset the top-line pressures S&P has focused on, he added.Barclays declined to comment.