The building was built between 1804 and 1807 to serve as the home for the royal courts of justice. It was the work of Juan Goycolea, a pupil and disciple of the Italian-born Joaquin Toesca who had designed the nearby La Moneda Palace and the east facade of the Cathedral during the last two decades of the 18th century. The courts were there for two years until Chile's first government junta, in 1810, assembled to replace the Spanish governor. Eight years later the Chilean Declaration of Independence was solidified and the building served as the first meeting place for the new congress. It served as the seat of government until 1846, until President Manuel Bulnes moved to La Moneda Palace.