Where does Star Wars: Knights of the Old Republic take place in the Star Wars Movies?

Does it take place before Episode I or after it and does it take place before Episode IV or after that?
4 answers 4