This study is designed as an extension study to the proof-of-concept trial CAIN457A2209 in patients with moderate to severe ankylosing spondylitis and aims to provide continuous treatment with AIN457 for patients in the core trial, to obtain safety and tolerability information. The study will address the evaluation of efficacy following doses of 3 mg/kg AIN457 given every 4 weeks over a period initially up to 6 months (Part 1) and based on the risk/benefit balance of AIN457 in ankylosing spondylitis a decision was taken to continue dosing for another 6 month period (Part 2).