This is not strictly true in all cases; while valid Apostolic succession is necessary for valid priesthood (Holy Orders), it is not sufficient; if proper form and/or intent is lost, the sacraments that require an ordained cleric, including Holy Orders, are forfeited. This was the case for the Church of England; there came a point when they lost Apostolic succession when no validly consecrated bishop remained, even if the first bishops to ordain/consecrate without proper form and/or intent were actual bishops in the line of Apostolic succession – the ordinations that they conferred on people was not valid, and it carried on till no validly consecrated bishop remained.
For a valid ordination to take place, there must be valid minister, subject, form, matter, and intent. If any of these five elements are lacking, the ordination is not valid.