Since the Kamakura period, bakufu (Japanese feudal government headed by a shogun) that served choka (the imperial family or household) with military power was refered to as buke (samural family), nobles who served choka in governmental affairs came to be called kuge.
鎌倉時代以降、武力で朝家に奉仕する幕府を武家と称するようになると、それに対比して、政務一般をもって朝家に奉仕する貴族一般を公家と呼ぶようになった。