NEW YORK (Reuters) - New Jersey and two of its distressed cities had the highest rates of U.S. foreclosure activity in the first half of 2016, according to RealtyTrac data released on Thursday.

New Jersey's foreclosure rate was 0.98 percent of housing units, or one in every 102 homes, the data showed. That was more than any other state and more than double the national rate of 0.40 percent, or one in 249 homes.

Atlantic County, home to New Jersey's cash-strapped gambling hub Atlantic City, again had the highest foreclosure rate of any major U.S. metropolitan area at 1.8 percent.

Four of Atlantic City's casinos closed in 2014 and remain shuttered, mostly because of gambling competition in neighboring states, though one, the Showboat, reopened this month as a hotel only.

Atlantic City has topped the national list of metro area foreclosures for at least a year.

Trenton, the state capital, was second with 1.31 percent during the first half of 2016.

Still, New Jersey was mostly in line with the national downward trend, which saw a 20 percent drop in foreclosure filings compared with the prior six months and an 11 percent decline over the first half of 2015 overall.

There were outliers, with 19 states posting year-over-year increases in the first half, including Massachusetts, Connecticut and Virginia.

Five big cities, all in the East, also had higher rates: Boston, Philadelphia, New York, Washington and Baltimore.

"Although there are some local outliers, the downward foreclosure trend continued in the first half of 2016 in most markets nationwide," Daren Blomquist, RealtyTrac senior vice president, said in a statement.

"While U.S. foreclosure activity is still above its pre-recession levels, many of the states hit hardest by the housing crisis have now dropped below pre-recession foreclosure activity levels," he said.