McGregor handed five-year deal