The de Blasio administration has relented and agreed to give investigators probing a suspicious land deal thousands of pages of internal documents the mayor’s lawyers had fought to keep secret.

The battle to obtain the documents pitted two mayoral agencies against each other: the Department of Investigation, which is scrutinizing the removal of deed restrictions involving one of Mayor Bill de Blasio’s top fundraisers, and the Law Department, which represented the mayor’s office.

A report released earlier this month by the Department of Investigation blamed “a complete lack of accountability” under de Blasio for the lifting of deed restrictions to allow a nonprofit nursing home on Manhattan’s Lower East Side to be flipped to luxury condos.

The deal netted developers a $72 million profit. The city was paid just $16 million for removing the restrictions.

The DOI found that City Hall “knew or should have known” about the land deal at the nursing home location known as Rivington House, which had served AIDS patients since the early 1990s.

A footnote in the report lamented that despite an executive order mandating that the DOI got to decide what was relevant to the probe and what wasn’t, the administration was refusing to hand over relevant documents. At one point, the administration sent investigators 990 blank pages, deeming the whited-out information as irrelevant.

In recent days, the Law Department relented after the DOI threatened to sue. The mayor’s office also agreed to allow investigators access to City Hall computers, a routine step in nearly every other probe done by the agency.

“DOI demonstrated that records the Law Department redacted and said were not relevant did, in fact, contain evidence relevant to our investigation,” the agency said Tuesday afternoon in a statement.

De Blasio earlier this weekend defended the agencies’ fight as “totally normal.”