800 years ago, an Ancient Alliance was formed by the kings of Twenty Kingdoms. The alliance included the Donquixote Family and the Nefeltari Family. During the Void Century, they fought against the Great Kingdom and successfully overthrew it.
Why or how the Twenty Kingdoms overthrew the Ancient Kingdom remains a mystery. After that, they banned research on the Poneglyphs and established their headquarters in Mary Geoise. Eventually, by 800 years ago the Alliance became the World Government.
The World Nobles, also known as the Celestial Dragons, are direct descendants of the founding kings who moved to Mary Geoise. As such, these Nobles possess the authority to do as they please, simply due to their heritage.
The World Government is a political organization comprised of the majority of the world at large, seemingly ruled by the Five Elders who in actuality answer to a ruler known simply as Im whose existence within the World Government is not known to the world at large.
The Marines serve as their primary military organization, headed by the Fleet Admiral, while the Cipher Pol operate behind the scenes, either through sabotage, reconnaissance, spying, espionage and/or assassination; their most powerful enemies are largely pirates and revolutionaries.
The Commander-in-Chief oversees both the Marines and Cipher Pol as well as the Shichibukai, at least officially, and ranks directly below the Gorosei.
Impel Down serves as the World Government’s most impenetrable maximum-security prison.