It happens when you marry a princess and then kill of her brothers and uncles. When the king dies you get their lands (provided no one else married a princess). I think going to war with them will invalidate your claim.
It happens very rarely, but if you have good assassins or inquisitors you might give it a try.
Bookmarks