HELENA, Mont. (AP) — The state's share of a national mortgage settlement will mostly be spent on foreclosure prevention, Attorney General Steve Bullock said Wednesday.

Montana received $5.8 million as part of the settlement with large mortgage companies over foreclosure abuses and fraud. Bullock said "greed" and "rampant abuse of our financial system" hurt millions of homeowners.

"Wall Street and the so-called 'too big to fail' banks have a lot to answer for," he said in a statement.

Bullock announced the statewide foreclosure prevention program at a news conference in Bozeman. He said $3 million will be used to hire more counselors at NeighborWorks Montana to help ensure that everyone who is eligible to receive a loan modification or other assistance gets the help they need.

Less than $1 million will go to the Montana Legal Services Association to help embattled homeowners experiencing legal problems, and $450,000 will go into the state general fund.

The rest will be used by the attorney general's office to fight financial fraud and deceptive practices, along with monitoring the settlement and working with the lenders to ensure that Montanans are getting the relief they deserve.

The attorney general's office said a one-stop online resource called "Keep My Montana Home" will provide information for homeowners fighting foreclosure. Homeowners can contact either the attorney general's office or local housing counselors to get the help.

Bullock said spending most of the money on more counselors was the best strategy to reach as many struggling homeowners as possible.

The multistate settlement money came from an investigation into the foreclosure process at five of the country's largest banks that found violations of state and federal law. Bank of America, Citibank, JP Morgan Chase, Wells Fargo and Ally/GMAC paid $25 billion under the settlement, the attorney general's office said.