When a ray of light travels from an optically denser medium to an optically rarer medium
Total Internal reflection happens only when light is travelling from an optically denser medium to an optically rarer medium.