Sequence of bifurcations in a three-dimensional system near a critical point