A total of 40 foreigners were arrested in the Ranga Reddy district of Telangana for staying illegally in India following the expiry of their visas, said N Prakash Reddy, Deputy Commissioner of Police (DCP) of Shamshabad area of the district on Thursday.