Prevention
A number of measures have been attempted to prevent seizures in those at risk. Following traumatic brain injury anticonvulsants decrease the risk of early seizures but not late seizures.In those with a history of febrile seizures, some medications (both antipyretics and anticonvulsants) have been found effective for reducing reoccurrence, however due to the frequency of adverse effects and the benign nature of febrile seizures the decision to use medication should be weighted carefully against potential negative effects.There is no clear evidence that antiepileptic drugs are effective or not effective at preventing seizures following a craniotomy, following subdural hematoma, after a stroke, or after subarachnoid haemorrhage, for both people who have had a previous seizure, and those who have not. Management
Potentially sharp or dangerous objects should be moved from the area around a person experiencing a seizure so that the individual is not hurt. After the seizure, if the person is not fully conscious and alert, they should be placed in the recovery position. A seizure longer than five minutes, or two or more seizures occurring within the time of five minutes is a medical emergency known as status epilepticus. Contrary to a common misconception, bystanders should not attempt to force objects into the mouth of the person having a seizure, as doing so may cause injury to the teeth and gums.Treatments of a person that is actively seizing follows a progression from initial response, through first line, second line, and third line treatments.
Very high body temperatures may also be a cause. Typically this requires a temperature greater than 42 °C (107.6 °F). Head injury may cause non-epileptic post-traumatic seizures or post-traumatic epilepsy
About 3.5 to 5.5% of people with celiac disease also have seizures. Seizures in a person with a shunt may indicate failure
Hemorrhagic stroke can occasionally present with seizures, embolic strokes generally do not (though epilepsy is a common later complication); cerebral venous sinus thrombosis, a rare type of stroke, is more likely to be accompanied by seizures than other types of stroke
Multiple sclerosis may cause seizures
Electroconvulsive therapy (ECT) deliberately sets out to induce a seizure for the treatment of major depression. Reflex seizure induced by a specific stimulus or trigger (extrinsic or intrinsic stimuli)

Mechanism
Normally, brain electrical activity is non-synchronous. In epileptic seizures, due to problems within the brain, a group of neurons begin firing in an abnormal, excessive, and synchronized manner. This results in a wave of depolarization known as a paroxysmal depolarizing shift.Normally after an excitatory neuron fires it becomes more resistant to firing for a period of time. This is due in part from the effect of inhibitory neurons, electrical changes within the excitatory neuron, and the negative effects of adenosine. In epilepsy the resistance of excitatory neurons to fire during this period is decreased. This may occur due to changes in ion channels or inhibitory neurons not functioning properly. Forty-one ion-channel genes and over 1,600 ion-channel mutations have been implicated in the development of epileptic seizure.