NEW YORK (AP) — American International Group's net income rose 27 percent in the second quarter as its property and casualty and life insurance business brought in more revenue.

During the quarter, AIG repaid all the loans it owed to the Federal Reserve as part of the financial rescue measures it received in 2008 and 2009.

AIG earned $2.33 billion, or $1.33 per share, versus $1.84 billion, or $1 per share, in the same period a year ago. Analysts surveyed by data provider FactSet were expecting the company to earn 58 cents per share in the quarter.

AIG's revenue rose 3 percent, to $17.12 billion from $16.68 billion.

Much of the AIG story since the financial crisis has revolved around the company's ability to pay back the U.S. government. In 2008 and 2009, the government stepped in with a $182.5 billion package to rescue AIG from collapse, making it the largest bailout in history.

Since then, the company has been selling off divisions and raising money to repay the loans. AIG today is about half the size of its former self. It has also been profitable the last two years.

AIG spent $2 billion in the second quarter buying back its own shares from the government, which still owns 61 percent of AIG.

AIG said that the Federal Reserve Bank of New York made a total of $12.7 billion in profits, interest payments and fees related to its loans to the troubled company. The Fed stands to gain more if it can sell the toxic assets it acquired during the crisis at a profit. AIG also stands to gain, since it will receive 33 percent of any profits that the Fed collects.

"We are proud of what we have accomplished and believe we are close to achieving our goal of returning to America all that it provided to AIG during the crisis, plus a profit," said AIG CEO Robert Benmosche.

In the second quarter, its property and casualty business Chartis reported income of $936 million, up from $783 million in the same quarter last year. Catastrophe-related losses fell and AIG fetched higher prices for its insurance.

The life insurance business SunAmerica Financial also posted higher income of $933 million, compared with $723 million last year. AIG put more of its cash in investments that produce interest income.

Last week AIG launched a public relations campaign on YouTube in an effort to repair its reputation. AIG hopes that the PR push will reduce the tarnish associated with its name. The YouTube videos thank America for the help and promise to make taxpayers whole, plus a profit.

In the fall, both Chartis and SunAmerica will give up their names and will be renamed AIG.