last night when I when to start the tour something strange happend

1) I opened the car door and the interior lights came on.
2) When I tried to start the car the lights went out
the car had no power. The door locks would not lock
3) I then opened the hood and touched the negative (red) terminal connections the cabin lights came back on and I was able to start the car.

The negative or red inner most cable connection was not loose. So what did I do when I touched it. Did I groud the battery? So is this an indication that my battery has a grounding issue?

Any thoughts