The cell cycle phase which is the first stage of M phase of meiosis and mitosis and during which chromosomes condense and the two daughter centrioles and their asters migrate toward the poles of the cell.