During the 1882 British invasion of Egypt, Fehmy was given responsibility for military fortifications by the leader of the nationalist government, Ahmed ʻUrabi. In this role, Fehmy oversaw the construction of the Egyptian fortifications at Kafr El Dawwar, and those stormed by the British at the Battle of Tell El Kebir. However, Fehmy did not manage to complete the works at Tell El Kebir, for he was captured by the British at the end of August 1882, while on a walk with a fellow officer. His capture was a serious loss to the Egyptian forces, as Fehmy was widely regarded as a bright and capable officer and engineer.