At the outbreak of the 1905 revolution, Hanecki returned illegally to Warsaw, with Felix Dzerzhinsky to run the SDKPiL's underground organisation, until Jogiches arrived, in October. He was a Polish delegate to the Fourth and Fifth RSDLP congresses in Stockholm, April 1906, and London, May 1907, and at the latter was elected an alternate member of the Central Committee of the RSDLP. Arrested several times, he escaped every time. He also facilitated Jogiches's escape from prison in April 1907, by bribing a police officer.