Dementia and atrial fibrillation (AF) are common comorbidities in stroke patients. The potential role of AF in cognitive impairment prior to a first stroke has yet not been characterized. The aim of our study was to evaluate the prevalence of prestroke cognitive impairment in stroke patients, and to identify whether AF is associated with prestroke cognitive impairment. In this prospective, single-center, explorative, observational study, consecutive patients with first ever transient ischemic attack (TIA), ischemic (IS) or hemorrhagic stroke (ICH) were included. For each patient cardiovascular risk factors and the National Institutes of Health Stroke Scale were recorded. Cognitive status prior to the stroke/TIA was assessed using the informant questionnaire on cognitive decline in the elderly (IQCODE). AF was diagnosed according to a standardised procedure that included the documented medical history, ECG upon admission, 24-h Holter-ECG, continuos ECG monitoring, and was categorized into paroxysmal and persistent. Logistic regression analysis was used to evaluate association of AF and prestroke cognitive impairment. A total of 788 patients were enrolled in our study. Of these, 548 (69.5 %) had an IS, TIA was present in 168 (21.3 %) and ICH in 72 (9.1 %) patients. Mean IQCODE was 3.1 (SD 0.4). Prestroke cognitive impairment (IQCODE ≥3.44) was detected in 96 (12.5 %) patients. Of these, 33 patients (4.3 %) were demented before the actual stroke event. AF was independently associated with prestroke cognitive impairment. Patients with an acute stroke frequently show a history of cognitive impairment before the event. AF is independently associated with prestroke cognitive impairment.