SAN JUAN, Puerto Rico (AP) — U.S. Attorney General Eric Holder pledged $10 million on Wednesday to the Puerto Rican government as it finalized a deal to reform the U.S. territory’s police agency, which has long been accused of illegal killings, corruption and civil rights violations.

The announcement ended two years of negotiations to transform the department. It is the second-largest force in the U.S. with more than 17,000 officers.

Puerto Rico has 10 years to implement all the changes, Holder said.

“Although I recognize that complete and lasting reform will not take hold overnight, I’m confident that this agreement lays out a clear path for responding to concerns, correcting troubling practices, safeguarding the rights of Puerto Rican citizens, restoring public trust, and ensuring public safety,” he said.

The 100-page agreement calls on the police department to build public confidence, establish new disciplinary procedures and create a use-of-force policy. It also demands additional training for officers before they’re assigned to the streets, and for a supervisor to be present when suspects resist arrest, among numerous other changes.

U.S. and local officials had signed the deal in December, but Puerto Rico’s government requested more time to modify the agreement.

Some changes were made given the economic realities of Puerto Rico, said Justice Secretary Luis Sanchez Betances. The island of 3.7 million people is struggling to emerge from a seven-year recession.

Sanchez said an estimated initial investment of $60 million to $80 million will be needed for changes in the first two years.

He said that U.S. and Puerto Rico officials have 90 days to choose an independent adviser to oversee the changes and if no agreement is reached, a federal judge will appoint someone.

Puerto Rico Police Chief Hector Pesquera said the department is committed to making all the changes.

Acting Associate Attorney Tony West said that on Thursday he will discuss the agreement with high-ranking police officials. He stressed that community leaders will be essential in helping reform the agency.

The call for reform came after a September 2011 federal report in which prosecutors condemned the police for what it said was numerous constitutional violations.

“Officers have unnecessarily injured hundreds of people and killed numerous others,” the report said. “The amount of crime and corruption involving … officers further illustrates that the Puerto Rico police department is in profound disrepair.”

Shortly afterward, the U.S. government filed a lawsuit noting that authorities had arrested more than 1,700 officers on charges including murder, rape and drug trafficking from January 2005 to November 2010.

Puerto Rico residents also filed more than 1,500 complaints against officers for unjustified or excessive force from 2004 to 2008.

The American Civil Liberties Union filed its own lawsuit accusing the police department of excessive force and civil rights violations. ACLU Executive Director Anthony Romero said the organization is close to reaching an agreement with the police agency to drop the legal action if the U.S. requirements are followed.

“We trust that this historic settlement means that Puerto Ricans will no longer have to live in fear of their own police force,” Romero said.