O.k.,this doesnt sound like a security component at fault here as the key would turn off and be able to be removed if it was.The security system only disables the starting but wont keep the key from being removed.
What will cause this is an internal electrical fault with the electronic ignition switch as I have seen this fail before in the past to where it fails to send a signal to allow the key to be released.I would have the signals checked with a compatible scan tool that can plug in and communicate with all computers to see if all signals are present with the switch to see if it needs replaced.
The other common fault is the park solenoid at the shifter.There is an electrical solenoid that activates when in park to allow the key to be removed.It also can disable starting of the engine if it doesnt think it is in park when this solenoid acts up.
These need to be checked into/tested further one observing ignition switch data on a scan tool and the other activating and observing the solenoid data on a scan tool to see which is the cause here.
In some cases you can push hard into park or shift in and out of park a few times and if it is the solenoid at fault the car will usually start and key removed but this doesnt work all of the time unfortunately.
If more help is needed, use the reply tab to continue our conversation. If no further assistance is needed, kindly rate my service,your 5 star rating is appreciated.You can rate at any time and we can continue to work on your question as this will not close out your question.Keep in mind in some cases it can be difficult to fully diagnose or help repair your vehicle without seeing it and I work on delivering the best possible answer from what I see to work with.