The past perfect, had + past participle, describes something that happened before an action described using past simple.
http://www.bbc.co.uk/learningenglish/english/course/intermediate/unit-7/session-2/activity-3