Eventually his lobbying was successful, and he was freed, just in time for him to take part in the rebellion.
Eventually his lobbying was successful. He was freed. This was just in time for him. This was to take part in the rebellion.