A computer-implemented method (200 400) of controlling the operation of a subscriber identity module, SIM, of an electronic device, wherein the SIM is configured to be able to respond to a request from a modem or processing unit of the electronic device with communication data that enables the modem or processing unit to initiate communications with a mobile network, the computer-implemented method comprising: determining (201 401) whether the electronic device and/or SIM is permitted to communicate using the mobile network, the determining comprising: modifying a first counter value, stored by the SIM, upon each unsuccessful connection attempt of the electronic device to the mobile network; and determining that the electronic device and/or SIM is not permitted to communicate using the mobile network in response to the first counter value reaching or breaching a first threshold counter value; in response to determining that the electronic device and/or SIM is not permitted to communicate using the mobile network, modifying (202 402) the contents of the SIM to prevent the SIM from responding to a request from the modem or processing unit of the electronic device with communication data that enables the modem or processing unit to initiate a communication request to the mobile network; responding, at the SIM, to a reset communication or reset instruction from a component of the electronic device by setting the first counter value to a first predetermined value; modifying a second counter value, stored by the SIM, in response to a reset communication; and preventing the first counter value from being set to the first predetermined value in response to the second counter value reaching or breaching a predetermined threshold. determining (201 401) whether the electronic device and/or SIM is permitted to communicate using the mobile network, the determining comprising: modifying a first counter value, stored by the SIM, upon each unsuccessful connection attempt of the electronic device to the mobile network; and determining that the electronic device and/or SIM is not permitted to communicate using the mobile network in response to the first counter value reaching or breaching a first threshold counter value; modifying a first counter value, stored by the SIM, upon each unsuccessful connection attempt of the electronic device to the mobile network; and determining that the electronic device and/or SIM is not permitted to communicate using the mobile network in response to the first counter value reaching or breaching a first threshold counter value; in response to determining that the electronic device and/or SIM is not permitted to communicate using the mobile network, modifying (202 402) the contents of the SIM to prevent the SIM from responding to a request from the modem or processing unit of the electronic device with communication data that enables the modem or processing unit to initiate a communication request to the mobile network; responding, at the SIM, to a reset communication or reset instruction from a component of the electronic device by setting the first counter value to a first predetermined value; modifying a second counter value, stored by the SIM, in response to a reset communication; and preventing the first counter value from being set to the first predetermined value in response to the second counter value reaching or breaching a predetermined threshold.