Morgan Stanley said Wednesday it lost more than $1.2 billion during the second quarter as it took a charge to repay government bailout money. The investment bank was also hurt for a second straight quarter by the improving value of its own debt. Morgan Stanley's trading profits and investment banking revenue, while strong, were unable to offset mounting charges during the second quarter, which also included losses tied to real estate investments. The bank said its net loss after payment of preferred dividends was $1.26 billion, or $1.10 per share, during the quarter ended June 30. The New York-based bank earned $1.06b., or $1.02 per share, during the same quarter last year. Analysts polled by Thomson Reuters, on average, forecast a loss of 49 cents per share for the quarter. Morgan Stanley said underwriting revenues rose 19% to $855 million during the quarter. As credit markets have improved, more companies have tapped equity and debt markets to raise much-needed capital. Like competitor Goldman Sachs Group Inc., Morgan Stanley was able to take advantage of that pent-up demand for underwriting new offerings. Revenue in Morgan Stanley's fixed income sales and trading division also increased. Revenue from the trading of interest rate, credit, currency and commodity products totaled $973m. in the second quarter, up 44% from a year earlier. Morgan Stanley's results were hampered significantly by an accounting rule related to the value of its debt. The rule requires companies, on paper, to record a loss to cover the additional cash it would require to meet its obligations when its debt is worth more. Essentially, if Morgan Stanley had to purchase its debt back at the end of the second quarter, it would have had to pay more for it than it would have a quarter earlier. So while the improving value of its debt means investors are more confident in its long-term prospects, it must take a loss because of that improving confidence. That accounting rule reduced Morgan Stanley's earnings by $1.32 per share in the second quarter. Revenue was reduced by $2.3b. because of the rule. Morgan Stanley also recorded an $850m., or 74 cents per share, charge for repaying the money it received from the government under the Troubled Asset Relief Program. Last fall, amid the mushrooming credit crisis that led to the collapse of fellow investment bank Lehman Brothers Holdings Inc., the government provided hundreds of banks with loans to try and restart stagnant credit markets. Last month, Morgan Stanley was one of 10 major banks that was approved to repay that loan. Morgan Stanley had received $10b. as part of the government's $700b. program. Both Goldman and JPMorgan Chase & Co. were among the other major banks that repaid TARP obligations last month. Morgan Stanley also recorded $700m. in charges tied to losses on investments in real estate. Problems in the real estate market began in 2007 with the value of residential real estate tumbling and sales declining. Now problems have emerged in commercial real estate as well. Banks with continued exposure to investments in real estate, such as Morgan Stanley, have been forced to take losses on those investments as the market continues to weaken.