Later, the state department said that one of the employees who looked at Obama's file was also found to have viewed McCain's records.
Clinton's file was accessed in summer 2007 by a trainee hired to help relieve the backlog of passport applications at the time, said Sean McCormack, a state department spokesman.
"In the case of Senator McCain, we detected earlier this year ... one of the same people who accessed Senator Obama's passport file also accessed Senator McCain's passport file," McCormack said.
It was unclear whether McCain, in France to meet Nicolas Sarkozy, the French president, was aware that his own records had been accessed.
"If anyone's privacy is breached, then they deserve an apology and a full
investigation and I believe this will take place,'' he said when asked about the state department's admission over Obama.
Obama said on Thursday that US Congress should be involved in any investigation into the breach.
"When you have not just one but a series of attempts to tap into peoples' personal records, that's a problem not just for me but for how our government functions,'' Obama said.
"I expect a full and thorough investigation. It should be done in conjunction with those congressional committees that have oversight so it's not simply an internal matter."
Rice said the Inspector General's office was to investigate the incident.