Representatives of City Hall and Central Park’s horse-drawn carriage industry were closer late Thursday to a deal that would preserve drivers’ jobs while moving the animals off city streets, but some unresolved details remained, sources familiar with the negotiations said.

A compromise would effectively end a saga that began more than two years ago with Mayor Bill de Blasio’s vow to ban, upon taking office, what he had called an “inhumane” practice.

Sources said the mayor’s office and the union that represents about 300 drivers and stable workers, Teamsters Joint Council 16, were trying to keep as many jobs as possible and find a new home for about 75 horses in a stable within Central Park.

The plan would move the animals from their West Side stables and limit their rides to car-free roads within the park. It takes them off what animal advocacy groups have said are dangerously crowded and polluted streets where motor vehicles travel.

De Blasio spokesman Wiley Norvell declined to comment on the details of the negotiation. Union spokesman Alex Moore also would not speak about the process.

NYCLASS, the animal rights group that has long pushed for a ban, said through spokesman Mike McKeon that it had no comment.

City Council members Ydanis Rodriguez (D-Manhattan) and Daniel Dromm (D-Queens) introduced a bill in December 2014 to phase out horse-drawn carriages and offered opportunities to drive green taxicabs to carriage operators who lost their jobs. But they had trouble gathering enough support from other city lawmakers.

Representatives for Rodriguez and Droom did not respond to requests for comment. An agreement would be heard in the council transportation committee, which Rodriguez chairs.