SAN FRANCISCO (AP) -- PG&E Corp. reported Thursday that its first-quarter profit fell as costs tied to its natural gas business and other items outweighed improved revenue.

The San Francisco-based utility has been tied up in court for its role in a deadly 2010 natural gas pipeline explosion in nearby San Bruno.

Federal prosecutors allege that its subsidiary Pacific Gas & Electric Co. knowingly relied on erroneous and incomplete information when assessing the safety of the pipeline that eventually ruptured and sparked a fireball that destroyed 38 San Bruno homes, killed eight people and injured dozens of others.

The company was charged in April with 12 federal felony violations of safety laws, which could carry fines of $6 million or more. PG&E pleaded not guilty last week. It may still face criminal charges.

PG&E said Thursday that it has committed $2.7 billion over the next several years for safety-related work following the incident. The company was weighed down in its most recent quarter by $40 million in legal and safety improvement costs tied to its natural gas business.

The company reported that it earned $227 million, or 49 cents per share, for the quarter that ended March 31. That is down from $239 million, or 55 cents per share, in the prior year. After adjusting for a number of special items, it earned 54 cents per share from operations versus 63 cents per share. Analysts polled by FactSet anticipated earnings of 65 cents per share.

Revenue rose to $3.89 billion from $3.67 billion. Analysts expected revenue of $3.9 billion

Shares of PG&E rose 10 cents to $45.68 in midday trading. Its shares are down more than 4 percent over the past year.