A pair of senior Wal-Mart executives knew cleaning contractors were hiring illegal immigrants, many of whom were housed in crowded conditions and sometimes slept in the backs of stores, according to a federal agency’s affidavit.

The affidavit, unsealed last week, was part of an investigation of Wal-Mart by federal immigration officials that led to the 2003 raid on 60 Wal-Mart stores in 21 states, and the arrests of 245 illegal workers.