WASHINGTON — SunTrust has agreed to pay nearly $1 billion to resolve allegations that it underwrote and endorsed faulty mortgage loans, the Justice Department announced Tuesday.

The $968 million settlement, reached with the Justice Department and other government agencies, will include money for homeowner relief and a requirement that the company improve its handling of mortgage loans and foreclosures.

In announcing the agreement, authorities said SunTrust Mortgage, a Richmond, Virginia-based mortgage lender and subsidiary of SunTrust Banks Inc., originated and underwrote bad loans between 2006 and 2012, gave borrowers false and misleading information about the status of foreclosure proceedings and charged unauthorized fees.

The company’s own internal documents showed an awareness of the problem, the government alleged, with one 2012 report referencing a “broken loan origination process.”

“SunTrust’s conduct is a prime example of the widespread underwriting failures that helped bring about the financial crisis” of 2008, Attorney General Eric Holder said in a statement. He said he expected similar cases in the future.

As part of the deal, SunTrust has agreed to provide $500 million to borrowers who are at risk of default and $418 million to resolve allegations that it underwrote bad loans. It’s also agreed to provide $40 million to foreclosure victims and $10 million to the federal government.

The settlement also involves the Department of Housing and Urban Development, the Consumer Financial Protection Bureau and state attorneys general from across the country. A monitor will ensure compliance with the agreement, which was filed in federal court in Washington.

SunTrust chief executive William H. Rogers Jr. said in a statement that SunTrust was pleased to have resolved the allegations. He said the company has made improvements to its mortgage underwriting processes and internal controls, including increased training.