text: But they in turn were ousted in a.d. 645 by Nakatomi Kamatari , founder of the great Fujiwara clan , which was to rule Japanese affairs for hundreds of years and provide prominent advisers to the emperor even up to the 19th century .
  
  ###
  
  The Fujiwara clan had political power in Japan up to the 19th century .