Arizona had the nation's second worst foreclosure filing rate in the first half of 2012, although filings decreased 37 percent from one year earlier, a foreclosure marketing company reported Thursday.

RealtyTrac reported in a press release that foreclosure filings were made on 1.7 percent of all Arizona housing units, or 49,157 properties. That's one in every 58.

That ranked the state second behind Nevada, which had a filing against one in every 57 residential properties. Nevada has been ranked worst in the nation for foreclosure activity for nearly all of the last five years.

RealtyTrac, based in Irvine, Calif., defines a foreclosure filing as a notice of default, auction notice or a bank repurchase, meaning that more than one filing could be counted on one property.

For June, Arizona also ranked second worst, behind California. The Grand Canyon State saw 9,393 foreclosure filings in the month, up less than 1 percent from May and down 30.2 percent from June 2011.

The national foreclosure picture generally continued to improve in the first half of the year, RealtyTrac reported. It said filings were down 11 percent from the first six months of 2011 and up 2 percent from the last six months of 2011.