Guard rails may be incorporated in switches, where they serve to prevent derailments caused by a train's wheels passing through the wrong side of the frog (the point where the straight and diverging rails cross).
In switches, guard rails are employed to avoid derailments caused by a train's wheels passing through the wrong side of the frog (where the straight and diverging tracks intersect).