This paper describes a powerful and versatile approach that combines the benefits of sol-gel processing with controlled phase separation to yield oxide-carbide-carbon or oxide-nitride-carbon nanocomposites.