It was in the spring of 1916 that Mata Hari must have been in contact with the German intelligence service. She was then staying for a few days in Cologne and Frankfort where she was instructed in the use of invisible ink. The Germans gave her the code name of H-21 and promised her NLG 20,000 for her services.

After an obstacle-filled trip, she was again back in Paris on 16 July 1916.Once in Paris she fell madly in love with the much younger but not so wealthy Vadime de Massloff, a captain in the First Russian Regiment for Special Services. De Massloff was billeted in Vittel which was situated in a fairly inaccessible military zone. To get a furlough-pass, Margreet had to apply to the Military Office for foreigners. Here she chanced to meet Captain Ladoux, the head of the French intelligence service. During their meeting, Ladoux asked her to start working as a spy for France. A little over two weeks later she accepted his proposal to go to Brussels to spy for the French.

On 6 November 1916, she left France to catch a ship in Spain for the Netherlands. When she arrived in Falmouth for a stopover, Mata Hari was taken from aboard ship due to Scotland Yard's suspicions that she was Clara Benedix, a German spy. After her interrogation, Sir Basil Thomas realized that she was not Benedix but still suspected her of 'partisan dealings'. Mata Hari was so unwise as to tell about her assignment from Captain Ladoux, but when Thompson wired France to find out about this, Ladoux's answer was that he knew nothing about it. Ladoux asked Thompson to send Mata Hari back to Spain, and on 11 December 1916 she was back in Madrid. She would stay for three weeks. During this time, she was in contact with Von Kalle, the military attache from the German Embassy in Madrid. When she still did not receive any new instructions from Paris, she decided to go to Paris herself. On 2 January 1917, she left Madrid. She went to see Ladoux, but he claimed to know nothing about what was going on. For another month she lived in her usual manner in Paris. On 13 February 1917 she was arrested in her room at the Elysées Palace Hotel.