Get hold of the "The Universe" on DVD, it's a series done by the History Channel. It's been on Pay TV as well of course.
http://shop.abc.net.au/browse/produc...oductid=770024
The fourth episode of Season 1 "Jupiter The Giant Planet" explains it all there. It draws in these large objects and then eventually slingshots them out of the solar system and out of harms way.
There's actually a snippet of this episode on You Tube. About 50 seconds in it starts to explain this phenomenon.
http://www.youtube.com/watch?v=O2wwwm1BRWQ
Great series and well worth getting a hold of.