A minimax principle for nonoverdamped systems