Used to express that somethign was wavering between two things or was wavering between doing or not doing something.
말락 can be replaced with another verb following (으)ㄹ락
If the situation that almost happened was accidental it's more common to use (으)ㄹ 뻔했다.