Setting: France, mid-19th century (literally a few years either side of 1850)
Character: Is 46 by the time this actually comes out, has been definitively not been able to get an erection since at least the age of 43 but almost certainly earlier. Character has been in prison from the age of 27 to the age of 43, no hard labour but a certain amount of violence (basically other prisoners and sometimes the guards kicking the shit out of him for jollies) for the first 7 or 8 years before removed to quieter, more Count of Monte Cristo-like confinement. Other injuries with current visible effects include a broken leg that healed a bit oddly (limps, but bears weight just fine) and a broken hand. Character ended up in prison related to attempted revolutionary actions - it's Paris, there are barricades every few years through the 1830s. The leg, a head laceration, and a couple stab wounds were the results of that action, though they are obviously long-healed by the time this story takes place. His last erection was whilst in prison, either during a rape or while masturbating at some point later (the time of last erection may be determined in part by the cause of the impotence).
Research question: Why can't he get it up? I can settle for psychological factors if necessary, but I'd prefer it be the result of physical trauma since there's been a certain amount of physical trauma in his history. The difficulty here is that there can be no obvious damage to the penis (uncircumcised) or testicles, as sometime after his release from prison, he went swimming with his brother (naked, obviously, at this period) and his brother noticed nothing. The brother has to be surprised when the character finally admits that he is incapable of defiling the housemaids.
I'd also settle for something STD related, if it could have been picked up by the age of 23 (a few celibate years prior to being taken wounded off a barricade) or be the result of prison rape and have no effects for several years.
Additionally, the character attended medical school for three of the four years it would have taken to receive a degree and served as an intern at a major hospital during the final year of his studies, but he never finished his degree, nor did he even come up with a subject for the require thesis. He may or may not be able to diagnose an injury or disease himself - either way is fine.
Previous searches: Searching for "impotence" or "erectile dysfunction" and "trauma" give me a certain amount of crap (frequent low-level, repetitive trauma like from riding a bike may cause ED - not helpful to anyone) or want to point me towards serious nerve damage, which I can't have because he walks around just fine except for the limp. I've also been pointed to Peyronie's disease, which is also completely unhelpful. The man can't get it up at all - he'd fine painful erections a comfort, as it would mean he still has all the appropriate reactions to a beautiful woman.
So, does he have an injury, VD, or a psychological problem? Preference is in that order.