Four major problems can affect the efficiency of methods developed to estimate relatedness between individuals from information of molecular markers: (i) some of them are dependent on the knowledge of the true allelic frequencies in the base population; (ii) they assume that all loci are unlinked and in Hardy–Weinberg and linkage equilibrium; (iii) pairwise methods can lead to incongruous assignations because they take into account only two individuals at a time; (iv) most are usually constructed for particular structured populations (only consider a few relationship classes, e.g. full-sibs vs. unrelated). We have developed a new approach to estimate relatedness that is free from the above limitations. The method uses a ‘blind search algorithm’ (actually simulated annealing) to find the genealogy that yield a co-ancestry matrix with the highest correlation with the molecular co-ancestry matrix calculated using the markers. Thus (i and ii) it makes no direct assumptions about allelic frequencies or Hardy–Weinberg and linkage equilibrium; (iii) it always provide congruent relationships, as it considers all individuals at a time; (iv) degrees of relatedness can be as complex as desired just increasing the ‘depth’ (i.e. number of generations) of the proposed genealogies. Computer simulations have shown that the accuracy and robustness against genotyping errors of this new approach is comparable to that of other proposed methods in those particular situations they were developed for, but it is more flexible and can cope with more complex situations.