We introduce a k-leaf removal algorithm as a generalization of the so-called leaf removal algorithm. In this pruning algorithm, vertices of degree smaller than k, together with their first nearest neighbors and all incident edges are progressively removed from a random network. As the result of this pruning the network is reduced to a subgraph which we call the Generalized k-core (Gkcore). Performing this pruning for the sequence of natural numbers k, we decompose the network into a hierarchy of progressively nested Gk-cores. We present an analytical framework for description of Gk-core percolation for undirected uncorrelated networks with arbitrary degree distributions (configuration model). To confirm our results, we also derive rate equations for the k-leaf removal algorithm which enable us to obtain the structural characteristics of the Gk-cores in another way. Also we apply our algorithm to a number of real-world networks and perform the Gk-core decomposition for them.