Emergency contraceptive pills are most effective when taken within 72 hours after having unprotected sex.