What causes the strange green flash at sunset and sunrise on Earth?

There are very special cases, when the sky is very clear and exceptionally transparent, that a green flash can be glimpsed just as the very topmost part of the sun is rising or setting.

What causes the strange green flash at sunset and sunrise on Earth?
There are very special cases, when the sky is very clear and exceptionally transparent, that a green flash can be glimpsed just as the very topmost part of the sun is rising or setting.