From encroachment to legal ownership