His first attempt to pass emancipation legislation failed in 1777 and failed again in 1785 , but he succeeded in 1799 , signing the law that eventually emancipated the slaves of New York ; the last were freed before his death .
His first two attempts to pass laws for the emancipation of all slaves in New York failed in 1777 and in 1785 , but his third attempt succeeded in 1799 .