What you are seeing in those images is an ice halo. A halo is an optical phenomenon produced by ice crystals. Many can be observed while looking at the Sun or the Moon.
To be precise, they are produced by the ice crystals in cirrus clouds high in the upper troposphere, at an altitude between 5 kilometres and 10 kilometres. The particular shape and orientation of the crystals is responsible for the type of halo observed. Light is reflected and refracted by the ice crystals and may split into colors because of dispersion. The crystals behave like prisms and mirrors, refracting and reflecting sunlight or moonlight between their faces, sending shafts of light in particular directions.
See this web page about atmospheric optics for more information on ice halos and other atmospherical optics phenomena.
This image shows an ice halo observed while looking at the Sun:
The following figure illustrates how the different geometries of the ice crystal create different types of ice halos: