The city's Cyber Command, which monitors more than 100 government agencies and offices, first detected the breach on Saturday, according to Laura Feyer, a spokeswoman for City Hall.
It is unclear if any private or sensitive data was taken in the breach, Ms. Feyer said. She added that no ransom was sought.
As a precaution, the city limited access to the Law Department's network on Sunday to maintain security, Ms. Feyer said. The department's lawyers didn't have access to their email accounts on Monday, according to the spokeswoman. The Law Department appears to be the only agency that was affected by the hack, according to City Hall.
The hack was earlier reported by the New York Daily News.
A spokeswoman for the city comptroller's office said that last month the comptroller's office completed an audit of the access and security controls of the Law Department's computer systems and issued several recommendations. The spokeswoman said in a statement that the cybersecurity audits aren't released publicly "due to the sensitivity of our findings and security concerns."
Ms. Feyer didn't immediately comment on the audit.
The Law Department has nearly 2,000 employees, including 1,000 lawyers. It represents the city in every legal aspect, including civil litigation filed against the mayor and other elected officials. Lawyers for the department also draft and review local and state laws, real-estate leases and other contracts on behalf of the city.
On Monday, Katherine Weall, a city Law Department attorney, said in a letter to a federal judge overseeing a civil-rights lawsuit against the city that the breach was affecting her ability to access her work.
"The Law Department has been experiencing a connectivity issue since yesterday, and, as a result, no one is currently able to log on to the Law Department's computer system," she said in the letter.
She asked the judge to grant her a seven-day extension in filing a response in the case.
Ms. Weall didn't immediately respond to a request for comment.
Several transportation systems and businesses around the country said last week that they were recent victims of cyberattacks, and in some cases the hacks disrupted their operations.
New York's Metropolitan Transportation Authority said Wednesday that in April hackers had accessed three of 18 computer systems used by the transit agency.
The MTA, which operates the New York City subway and bus systems and two commuter rail lines, said that the cyberattack didn't disrupt any operations and had no impact on riders, employees or contractors. A forensic audit found no evidence that accounts were compromised, MTA officials said.