IN 2001 Devah Pager, then a doctoral candidate in sociology at the University of Wisconsin, Madison, enlisted a group of 23-year-old male college students to pose as applicants for entry-level jobs advertised online and in a Milwaukee newspaper. Some of the students were black; some were white. Some were assigned a (fake) criminal record; others were not. In all they visited 350 employers.

Ms Pager’s study showed two things. First, employers were reluctant to hire applicants with criminal records. (No surprise there.) Second, being black increased a criminal record’s negative effects. White applicants without a record were twice as likely to be called back as those with one (34% to 17%). For black applicants that gap rose to almost threefold (14% to 5%). Ms Pager’s study was replicated in New York with similar results.

The Equal Employment Opportunity Commission (EEOC), a federal agency, has been crusading against such bias with renewed vigour since Barack Obama became president. On June 11th it filed complaints against two firms: BMW, a carmaker, and Dollar General, a chain of discount stores. It alleges that they used criminal-background checks in a way that had an unfairly “disparate impact” on black applicants.

Between 2004 and 2007 Dollar General carried out background checks on 344,300 people to whom it had made conditional job offers; 25% of these applicants were black. Of the 26,700 who had their job offers revoked for having criminal records, 31% were black. BMW checked 645 people in 2008, of whom 55% were black. It rejected 88, of whom 80% were black.

Employers face a dilemma. They cannot simply ignore applicants’ criminal histories. State and federal laws bar some felons from certain jobs, such as airport security or working with children or the elderly. And businesses risk lawsuits if they hire an ex-offender who harms or steals from a customer. Yet because black and Hispanic Americans are much more likely to have been convicted of a crime than whites or Asians, firms that screen out felons risk being accused of racism.

The EEOC says it is not that simple. Its guidelines recommend that employers provide “an opportunity for an individual assessment” that takes into account “at least the nature of the crime, the time elapsed and the nature of the job”.

The type of crime a job applicant has committed is often less relevant than how long ago he committed it, says Shawn Bushway, a criminologist at the University at Albany-SUNY. A young one-time offender is much more likely to commit another crime than someone who has never been convicted of anything. But Mr Bushway found that the gap narrows to almost nothing after enough time—around 13 years for someone who was under 26 at the time of his offence, with the amount of time decreasing as the offender’s age rises. In other words, 40-year-olds who were terrible in their 20s pose little risk today.

The EEOC alleges that BMW and Dollar both used background checks in a manner “not job-related and consistent with business necessity” (generally a valid defence against an accusation of disparate-impact discrimination). One applicant to Dollar was rejected because of a six-year-old conviction for drug possession, another because the background checker made a mistake, says the EEOC. The companies deny the allegations; both say their use of criminal-background checks is designed to keep their workplaces safe. They plan to fight the charges in court.

In general, it is hardly surprising that companies hesitate to hire ex-convicts. No nursery wants to employ a paedophile, and no company wants to put a thief in charge of petty cash or a killer on the reception desk. Yet society is worse off if ex-convicts cannot find work. Those without jobs are less likely to pay compensation to their victims and more likely to reoffend.

Rehabilitating criminals is a bigger problem in America than in any other rich country, simply because it brands more people criminals. In 2010 a whopping 25% of African-American and 6% of non-black adults were either felons or ex-felons, estimates Sarah Shannon of the University of Minnesota. To encourage firms to give ex-cons a fair shot, 50 cities and several states have enacted “Ban the Box” rules, which bar employers from inquiring about a jobseeker’s criminal history until later in the application. It might also help if the criminal-justice system discriminated more vigorously between dangerous criminals and non-violent ones—and locked up fewer of the latter.