The emperor, and sometimes the empress, was the official ruler of Japan throughout history. They derived their authority through the Shinto religion in which the imperial family is believed to have descended from the Sun Goddess. During the feudal periods (1185-1868), emperors held little real power, which resided with the military class. Power was effectively usurped, but the authority and prestige of the imperial line helped prevent dynastic overthrow. Under the Meiji constitution (1889), the emperor was declared sovereign, sacred and 'inviolable', but he was still only a figurehead. Under the 1946 constitution, the emperor was reduced to being a constitutional monarch as in the British system.